/** Show the filter dialog */
 public void showDialog() {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   include_panel =
       new ServiceFilterPanel("Include messages based on target service:", filter_include_list);
   exclude_panel =
       new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list);
   status_box = new JCheckBox("Filter messages based on status:");
   status_box.addActionListener(this);
   status_active = new JRadioButton("Active messages only");
   status_active.setSelected(true);
   status_active.setEnabled(false);
   status_complete = new JRadioButton("Complete messages only");
   status_complete.setEnabled(false);
   status_group = new ButtonGroup();
   status_group.add(status_active);
   status_group.add(status_complete);
   if (filter_active || filter_complete) {
     status_box.setSelected(true);
     status_active.setEnabled(true);
     status_complete.setEnabled(true);
     if (filter_complete) {
       status_complete.setSelected(true);
     }
   }
   status_options = new JPanel();
   status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS));
   status_options.add(status_active);
   status_options.add(status_complete);
   status_options.setBorder(indent_border);
   status_panel = new JPanel();
   status_panel.setLayout(new BorderLayout());
   status_panel.add(status_box, BorderLayout.NORTH);
   status_panel.add(status_options, BorderLayout.CENTER);
   status_panel.setBorder(empty_border);
   ok_button = new JButton("Ok");
   ok_button.addActionListener(this);
   cancel_button = new JButton("Cancel");
   cancel_button.addActionListener(this);
   buttons = new JPanel();
   buttons.setLayout(new FlowLayout());
   buttons.add(ok_button);
   buttons.add(cancel_button);
   panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
   panel.add(include_panel);
   panel.add(exclude_panel);
   panel.add(status_panel);
   panel.add(buttons);
   dialog = new JDialog();
   dialog.setTitle("SOAP Monitor Filter");
   dialog.setContentPane(panel);
   dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   dialog.setModal(true);
   dialog.pack();
   Dimension d = dialog.getToolkit().getScreenSize();
   dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2);
   ok_pressed = false;
   dialog.show();
 }
Пример #2
0
 /** Create and show the gui */
 public void showDialog() {
   if (dialog == null) {
     JFrame parentFrame = persistenceManager.getIdv().getIdvUIManager().getFrame();
     dialog = new JDialog(parentFrame, "Loading Bundle");
     if (dialogTitle != null) {
       dialog.setTitle("Loading Bundle: " + dialogTitle);
     }
     dialog.getContentPane().add(contents);
   }
   dialog.pack();
   Point center = GuiUtils.getLocation(null);
   if (persistenceManager.getIdv().okToShowWindows()) {
     dialog.setLocation(20, 20);
     dialog.setVisible(true);
   }
 }
  public void createDialogBox(String Roll, String ExamYear) {
    RPS = new JDialog();

    this.NumberOfCourses = DataTransfer.Courses.size();
    this.Roll = Roll;
    this.ExamYear = ExamYear;
    this.Session = setSession();
    final int Final = NumberOfCourses;
    final int Height = (Final * 40 + 270 > 600) ? Final * 40 + 270 : 600;

    Panel =
        new JPanel() {
          protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(
                new ImageIcon(getClass().getResource("/Icons/8.jpg")).getImage(),
                0,
                0,
                950,
                Height,
                null);
            ButtonBorder.paintBorder(this, g, 284, 84 + Final * 40 + 60 + 60, 252, 32);
          }
        };

    Panel.setPreferredSize(
        new Dimension(
            600,
            NumberOfCourses * 40
                + 150
                + 60
                + 60)); // 50+(100*5+3*5)+50, 120+NumberOfCourses*30+(NumberOfCourses-1)*10+50+60
    Panel.setLayout(null);

    RollLabel = new JLabel("Roll  :  " + this.Roll, SwingConstants.CENTER);
    RollLabel.setForeground(Color.WHITE);
    RollLabel.setFont(new Font("SERRIF", Font.BOLD, 15));
    RollLabel.setBounds(112, 20, 615, 20);
    Panel.add(RollLabel);

    SessionLabel = new JLabel("Session  :  " + this.Session, SwingConstants.CENTER);
    SessionLabel.setForeground(Color.WHITE);
    SessionLabel.setFont(new Font("SERRIF", Font.BOLD, 15));
    SessionLabel.setBounds(112, 40, 615, 20);
    Panel.add(SessionLabel);

    ColumnName = new JLabel("", SwingConstants.LEFT);
    ColumnName.setText(
        "     COURSE NO.        TOTAL MARKS      GRADE POINT      LETTER GRADE        COURSE CREDIT                 EXAM-TYPE");
    ColumnName.setForeground(Color.WHITE);
    ColumnName.setFont(new Font("SERRIF", Font.BOLD, 10));
    ColumnName.setBounds(112, 80, 635, 30);
    Panel.add(ColumnName);

    TakenLabel1 = new JLabel("Credit Hour Taken  :  ", SwingConstants.RIGHT);
    TakenLabel1.setForeground(Color.WHITE);
    TakenLabel1.setFont(new Font("SERRIF", Font.ITALIC, 12));
    TakenLabel1.setBounds(112, 85 + NumberOfCourses * 40 + 60, 130, 20);
    Panel.add(TakenLabel1);

    TakenLabel2 = new JLabel("", SwingConstants.LEFT);
    TakenLabel2.setForeground(Color.WHITE);
    TakenLabel2.setFont(new Font("SERRIF", Font.ITALIC, 12));
    TakenLabel2.setBounds(242, 85 + NumberOfCourses * 40 + 60, 50, 20);
    Panel.add(TakenLabel2);

    CompletedLabel1 = new JLabel("Credit Hour Completed  :  ", SwingConstants.RIGHT);
    CompletedLabel1.setForeground(Color.WHITE);
    CompletedLabel1.setFont(
        new Font("SERRIF", Font.ITALIC, 12)); // 50,85+NumberOfCourses*40+60+20,150,20
    CompletedLabel1.setBounds(342, 85 + NumberOfCourses * 40 + 60, 150, 20);
    Panel.add(CompletedLabel1);

    CompletedLabel2 = new JLabel("opps", SwingConstants.LEFT);
    CompletedLabel2.setForeground(Color.WHITE);
    CompletedLabel2.setFont(new Font("SERRIF", Font.ITALIC, 12));
    CompletedLabel2.setBounds(492, 85 + NumberOfCourses * 40 + 60, 50, 20);
    Panel.add(CompletedLabel2);

    GPALabel1 = new JLabel("GPA  :  ", SwingConstants.RIGHT);
    GPALabel1.setForeground(Color.WHITE);
    GPALabel1.setFont(new Font("SERRIF", Font.ITALIC, 12));
    GPALabel1.setBounds(552, 85 + NumberOfCourses * 40 + 60, 80, 20);
    Panel.add(GPALabel1);

    GPALabel2 = new JLabel("36.25", SwingConstants.LEFT);
    GPALabel2.setForeground(Color.WHITE);
    GPALabel2.setFont(new Font("SERRIF", Font.ITALIC, 12));
    GPALabel2.setBounds(632, 85 + NumberOfCourses * 40 + 60, 50, 20);
    Panel.add(GPALabel2);

    DocButton = new JButton("Create Document");
    DocButton.setFont(new Font("SERRIF", Font.BOLD, 15));
    DocButton.setBounds(
        285,
        85 + NumberOfCourses * 40 + 60 + 60,
        250,
        30); // 50+NumberOfCourses*30+(NumberOfCourses-1)*10+35
    DocButton.addActionListener(this);
    Panel.add(DocButton);

    CheckAll = new JCheckBox("Uncheck all");
    CheckAll.setForeground(Color.WHITE);
    CheckAll.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 12));
    CheckAll.setOpaque(false);
    CheckAll.setSelected(true);
    CheckAll.addActionListener(this);

    setComponentsOnTheGrid();

    Scroll =
        new JScrollPane(
            Panel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    RPS.add(Scroll);

    RPS.setModal(true);
    RPS.setTitle(" Result : Particular Student ");
    RPS.setResizable(false);
    RPS.setSize(840, 565);
    RPS.setLocation(
        250, 100 + (565 - RPS.getHeight()) / 2); // setiing RPS dialogbox in the middle of MenuFrame
    RPS.setVisible(true);
  }
  protected boolean exportApplicationPrompt() throws IOException, SketchException {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(Box.createVerticalStrut(6));

    // Box panel = Box.createVerticalBox();

    // Box labelBox = Box.createHorizontalBox();
    //    String msg = "<html>Click Export to Application to create a standalone, " +
    //      "double-clickable application for the selected plaforms.";

    //    String msg = "Export to Application creates a standalone, \n" +
    //      "double-clickable application for the selected plaforms.";
    String line1 = "Export to Application creates double-clickable,";
    String line2 = "standalone applications for the selected plaforms.";
    JLabel label1 = new JLabel(line1, SwingConstants.CENTER);
    JLabel label2 = new JLabel(line2, SwingConstants.CENTER);
    label1.setAlignmentX(Component.LEFT_ALIGNMENT);
    label2.setAlignmentX(Component.LEFT_ALIGNMENT);
    //    label1.setAlignmentX();
    //    label2.setAlignmentX(0);
    panel.add(label1);
    panel.add(label2);
    int wide = label2.getPreferredSize().width;
    panel.add(Box.createVerticalStrut(12));

    final JCheckBox windowsButton = new JCheckBox("Windows");
    // windowsButton.setMnemonic(KeyEvent.VK_W);
    windowsButton.setSelected(Preferences.getBoolean("export.application.platform.windows"));
    windowsButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean(
                "export.application.platform.windows", windowsButton.isSelected());
          }
        });

    final JCheckBox macosxButton = new JCheckBox("Mac OS X");
    // macosxButton.setMnemonic(KeyEvent.VK_M);
    macosxButton.setSelected(Preferences.getBoolean("export.application.platform.macosx"));
    macosxButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean("export.application.platform.macosx", macosxButton.isSelected());
          }
        });

    final JCheckBox linuxButton = new JCheckBox("Linux");
    // linuxButton.setMnemonic(KeyEvent.VK_L);
    linuxButton.setSelected(Preferences.getBoolean("export.application.platform.linux"));
    linuxButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean("export.application.platform.linux", linuxButton.isSelected());
          }
        });

    JPanel platformPanel = new JPanel();
    // platformPanel.setLayout(new BoxLayout(platformPanel, BoxLayout.X_AXIS));
    platformPanel.add(windowsButton);
    platformPanel.add(Box.createHorizontalStrut(6));
    platformPanel.add(macosxButton);
    platformPanel.add(Box.createHorizontalStrut(6));
    platformPanel.add(linuxButton);
    platformPanel.setBorder(new TitledBorder("Platforms"));
    // Dimension goodIdea = new Dimension(wide, platformPanel.getPreferredSize().height);
    // platformPanel.setMaximumSize(goodIdea);
    wide = Math.max(wide, platformPanel.getPreferredSize().width);
    platformPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    panel.add(platformPanel);

    //  Box indentPanel = Box.createHorizontalBox();
    //  indentPanel.add(Box.createHorizontalStrut(new JCheckBox().getPreferredSize().width));
    final JCheckBox showStopButton = new JCheckBox("Show a Stop button");
    // showStopButton.setMnemonic(KeyEvent.VK_S);
    showStopButton.setSelected(Preferences.getBoolean("export.application.stop"));
    showStopButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean("export.application.stop", showStopButton.isSelected());
          }
        });
    showStopButton.setEnabled(Preferences.getBoolean("export.application.fullscreen"));
    showStopButton.setBorder(new EmptyBorder(3, 13, 6, 13));
    //  indentPanel.add(showStopButton);
    //  indentPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    final JCheckBox fullScreenButton = new JCheckBox("Full Screen (Present mode)");
    // fullscreenButton.setMnemonic(KeyEvent.VK_F);
    fullScreenButton.setSelected(Preferences.getBoolean("export.application.fullscreen"));
    fullScreenButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            boolean sal = fullScreenButton.isSelected();
            Preferences.setBoolean("export.application.fullscreen", sal);
            showStopButton.setEnabled(sal);
          }
        });
    fullScreenButton.setBorder(new EmptyBorder(3, 13, 3, 13));

    JPanel optionPanel = new JPanel();
    optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS));
    optionPanel.add(fullScreenButton);
    optionPanel.add(showStopButton);
    //    optionPanel.add(indentPanel);
    optionPanel.setBorder(new TitledBorder("Options"));
    wide = Math.max(wide, platformPanel.getPreferredSize().width);
    // goodIdea = new Dimension(wide, optionPanel.getPreferredSize().height);
    optionPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    // optionPanel.setMaximumSize(goodIdea);
    panel.add(optionPanel);

    Dimension good;
    // label1, label2, platformPanel, optionPanel
    good = new Dimension(wide, label1.getPreferredSize().height);
    label1.setMaximumSize(good);
    good = new Dimension(wide, label2.getPreferredSize().height);
    label2.setMaximumSize(good);
    good = new Dimension(wide, platformPanel.getPreferredSize().height);
    platformPanel.setMaximumSize(good);
    good = new Dimension(wide, optionPanel.getPreferredSize().height);
    optionPanel.setMaximumSize(good);

    //    JPanel actionPanel = new JPanel();
    //    optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.X_AXIS));
    //    optionPanel.add(Box.createHorizontalGlue());

    //    final JDialog frame = new JDialog(editor, "Export to Application");

    //    JButton cancelButton = new JButton("Cancel");
    //    cancelButton.addActionListener(new ActionListener() {
    //      public void actionPerformed(ActionEvent e) {
    //        frame.dispose();
    //        return false;
    //      }
    //    });

    // Add the buttons in platform-specific order
    //    if (PApplet.platform == PConstants.MACOSX) {
    //      optionPanel.add(cancelButton);
    //      optionPanel.add(exportButton);
    //    } else {
    //      optionPanel.add(exportButton);
    //      optionPanel.add(cancelButton);
    //    }
    String[] options = {"Export", "Cancel"};
    final JOptionPane optionPane =
        new JOptionPane(
            panel,
            JOptionPane.PLAIN_MESSAGE,
            // JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_OPTION,
            null,
            options,
            options[0]);

    final JDialog dialog = new JDialog(this, "Export Options", true);
    dialog.setContentPane(optionPane);

    optionPane.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent e) {
            String prop = e.getPropertyName();

            if (dialog.isVisible()
                && (e.getSource() == optionPane)
                && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
              // If you were going to check something
              // before closing the window, you'd do
              // it here.
              dialog.setVisible(false);
            }
          }
        });
    dialog.pack();
    dialog.setResizable(false);

    Rectangle bounds = getBounds();
    dialog.setLocation(
        bounds.x + (bounds.width - dialog.getSize().width) / 2,
        bounds.y + (bounds.height - dialog.getSize().height) / 2);
    dialog.setVisible(true);

    Object value = optionPane.getValue();
    if (value.equals(options[0])) {
      return jmode.handleExportApplication(sketch);
    } else if (value.equals(options[1]) || value.equals(new Integer(-1))) {
      // closed window by hitting Cancel or ESC
      statusNotice("Export to Application canceled.");
    }
    return false;
  }
Пример #5
0
  /**
   * Create a new ProjectionManager.
   *
   * @param parent JFrame (application) or JApplet (applet)
   * @param projections list of initial projections
   * @param makeDialog true to make this a dialog
   * @param helpId help id if dialog
   * @param maps List of MapData
   */
  public ProjectionManager(
      RootPaneContainer parent, List projections, boolean makeDialog, String helpId, List maps) {

    this.helpId = helpId;
    this.maps = maps;
    this.parent = parent;

    // manage NewProjectionListeners
    lm =
        new ListenerManager(
            "java.beans.PropertyChangeListener",
            "java.beans.PropertyChangeEvent",
            "propertyChange");

    // here's where the map will be drawn: but cant be changed/edited
    npViewControl = new NPController();
    if (maps == null) {
      maps = getDefaultMaps(); // we use the system default
    }
    for (int mapIdx = 0; mapIdx < maps.size(); mapIdx++) {
      MapData mapData = (MapData) maps.get(mapIdx);
      if (mapData.getVisible()) {
        npViewControl.addMap(mapData.getSource(), mapData.getColor());
      }
    }
    mapViewPanel = npViewControl.getNavigatedPanel();
    mapViewPanel.setPreferredSize(new Dimension(250, 250));
    mapViewPanel.setToolTipText("Shows the default zoom of the current projection");
    mapViewPanel.setChangeable(false);

    if ((projections == null) || (projections.size() == 0)) {
      projections = makeDefaultProjections();
    }

    // the actual list is a JTable subclass
    projTable = new JTableProjection(this, projections);

    JComponent listContents = new JScrollPane(projTable);

    JComponent buttons =
        GuiUtils.hbox(
            GuiUtils.makeButton("Edit", this, "doEdit"),
            GuiUtils.makeButton("New", this, "doNew"),
            GuiUtils.makeButton("Export", this, "doExport"),
            GuiUtils.makeButton("Delete", this, "doDelete"));

    mapLabel = new JLabel(" ");
    JComponent leftPanel = GuiUtils.inset(GuiUtils.topCenter(mapLabel, mapViewPanel), 5);

    JComponent rightPanel = GuiUtils.topCenter(buttons, listContents);
    rightPanel = GuiUtils.inset(rightPanel, 5);
    contents = GuiUtils.inset(GuiUtils.hbox(leftPanel, rightPanel), 5);

    // default current and working projection
    if (null != (current = projTable.getSelected())) {
      setWorkingProjection(current);
      projTable.setCurrentProjection(current);
      mapLabel.setText(current.getName());
    }

    /* listen for new working Projections from projTable */
    projTable.addNewProjectionListener(
        new NewProjectionListener() {
          public void actionPerformed(NewProjectionEvent e) {
            if (e.getProjection() != null) {
              setWorkingProjection(e.getProjection());
            }
          }
        });

    eventsOK = true;

    // put it together in the viewDialog
    if (makeDialog) {
      Container buttPanel = GuiUtils.makeApplyOkHelpCancelButtons(this);
      contents = GuiUtils.centerBottom(contents, buttPanel);
      viewDialog =
          GuiUtils.createDialog(GuiUtils.getApplicationTitle() + "Projection Manager", false);
      viewDialog.getContentPane().add(contents);
      viewDialog.pack();
      ucar.unidata.util.Msg.translateTree(viewDialog);
      viewDialog.setLocation(100, 100);
    }
  }