示例#1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
示例#2
1
  public BrowserFrame(Browser b) {
    super("Cavity Nesting DB Browser");
    browser = b;

    JPanel content = new JPanel(new BorderLayout());
    content.setOpaque(true);
    setContentPane(content);

    content.add(browser, BorderLayout.CENTER);

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosed(WindowEvent e) {
            browser.closeBrowser();
          }
        });

    createJMenuBar();
    setJMenuBar(menubar);

    setVisible(true);
    pack();
  }
  public RobonoboFrame(RobonoboController control, String[] args) {
    this.control = control;
    this.cmdLineArgs = args;

    setTitle("robonobo");
    setIconImage(GUIUtils.getImage("/icon/robonobo-64x64.png"));
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addWindowListener(new CloseListener());

    menuBar = Platform.getPlatform().getMenuBar(this);
    setJMenuBar(menuBar);

    JPanel contentPane = new JPanel();
    double[][] cellSizen = {{5, 200, 5, TableLayout.FILL, 5}, {3, TableLayout.FILL, 5}};
    contentPane.setLayout(new TableLayout(cellSizen));
    setContentPane(contentPane);
    leftSidebar = new LeftSidebar(this);
    contentPane.add(leftSidebar, "1,1");
    mainPanel = new MainPanel(this);
    contentPane.add(mainPanel, "3,1");
    setPreferredSize(new Dimension(1024, 723));
    pack();
    leftSidebar.selectMyMusic();
    guiConfig = (GuiConfig) control.getConfig("gui");
    addListeners();
  }
  /*
   * The following method creates the color chooser dialog box
   */
  public void createColorDialog() {
    colorDialog = new JDialog(this, new String("Choose a color"), true);
    colorDialog.getContentPane().add(createColorPicker(), BorderLayout.CENTER);

    JButton okButton = new JButton("OK");

    // This class is used to create a special ActionListener for
    //    the ok button
    class ButtonListener implements ActionListener {
      /*
       * This method is called whenever the ok button is clicked
       */
      public void actionPerformed(ActionEvent event) {
        currentChoice.changeColor(color_panel.getColor());
        currentChoice.repaint();
        fontColor = color_panel.getColor();
        colorDialog.hide();
      } // end actionPerformed method
    }
    ActionListener listener = new ButtonListener();
    okButton.addActionListener(listener);

    // Add the four font control panels to one big panel using
    //  a grid layout
    JPanel buttonPanel = new JPanel();

    buttonPanel.add(okButton);

    // Add the button panel to the content pane of the ColorDialogue
    colorDialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    colorDialog.pack();
  }
  /*
   * The following method creates the textfield to change the text
   *     and the button to update the label.
   * postcondition: returns the panel containing the textfield and button.
   */
  public JPanel createUpdateButton() {
    JLabel textLabel = new JLabel(new String("Change text to: "));

    textField = new JTextField(new String("Big Java"), 20);
    textField.setFont(new Font(("Times"), Font.PLAIN, 12));

    update = new JButton(new String("Update"));
    update.setDefaultCapable(true);

    // This class is used to create a special ActionListener for this menu item
    class ButtonListener implements ActionListener {
      /*
       * This method is called when the update button is clicked
       */
      public void actionPerformed(ActionEvent event) {
        // Call the method to change the text on the screen.
        setSampleFont();
      } // end actionPerformed method
    }
    ActionListener listener = new ButtonListener();
    update.addActionListener(listener);

    JPanel panel = new JPanel();

    panel.add(textLabel);
    panel.add(textField);
    panel.add(update);

    return panel;
  } // end createUpdateButton method
示例#6
0
  public ActionFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    buttonPanel = new JPanel();

    // define actions
    Action yellowAction = new ColorAction("Yellow", new ImagIcon("yellow-ball.gif"), Color.YELLOW);
    Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE);
    Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED);

    // add buttons for these actions
    buttonPanel.add(new JButton(yellowAction));
    buttonPanel.add(new JButton(blueAction));
    buttonPanel.add(new JButton(recAction));

    // add panel to frame
    add(buttonPanel);

    // associate the Y, B, and R keys with names
    InputMap imap = buttonPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    imap.put(KeyStroke.getKeyStroke("ctrl Y"), "panel.yellow");
    imap.put(KeyStroke.getKeyStroke("Ctrl B"), "panel.blue");
    imap.put(KeyStroke.getKeyStroke("ctrl R"), "panel.red");

    // associate the names with actions
    ActionMap amap = buttonPanel.getActionMap();
    amap.put("panel.yellow", yellowAction);
    amap.put("panel.blue", blueAction);
    amap.put("panel.red", redAction);
  }
示例#7
0
    private JPanel createCompPanel() {
      filesets = new Vector();

      int count = installer.getIntegerProperty("comp.count");
      JPanel panel = new JPanel(new GridLayout(count, 1));

      String osClass = OperatingSystem.getOperatingSystem().getClass().getName();
      osClass = osClass.substring(osClass.indexOf('$') + 1);

      for (int i = 0; i < count; i++) {
        String os = installer.getProperty("comp." + i + ".os");

        if (os != null && !osClass.equals(os)) continue;

        JCheckBox checkBox =
            new JCheckBox(
                installer.getProperty("comp." + i + ".name")
                    + " ("
                    + installer.getProperty("comp." + i + ".disk-size")
                    + "Mb)");
        checkBox.getModel().setSelected(true);
        checkBox.addActionListener(this);
        checkBox.setRequestFocusEnabled(false);

        filesets.addElement(new Integer(i));

        panel.add(checkBox);
      }

      Dimension dim = panel.getPreferredSize();
      dim.width = Integer.MAX_VALUE;
      panel.setMaximumSize(dim);

      return panel;
    }
示例#8
0
文件: About.java 项目: annsofi/kalken
  public About() {
    cl = ClassLoader.getSystemClassLoader();

    // ----------------------------------------CENTER--------------------------------//
    imgAbout = new ImageIcon(cl.getResource("om.png"));

    lblAbout = new JLabel(imgAbout);

    lblAbout.setBounds(0, 0, 450, 263);

    JPanel pnlCenter = new JPanel();
    pnlCenter.setLayout(null);
    pnlCenter.add(lblAbout);

    btnOk = new JButton(new ImageIcon(cl.getResource("ok.png")));
    btnOk.setBounds(390, 215, 40, 30);
    pnlCenter.add(btnOk);
    btnOk.addActionListener(this);

    // -----------------------------------CONTAINER----------------------------------//
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(pnlCenter, BorderLayout.CENTER);
    setSize(450, 280);
    setVisible(true);
    setResizable(false);
    setLocation(580, 280);
    // setDefaultCloseOperation(EXIT_ON_CLOSE);

  }
示例#9
0
    private JPanel makeAttributesPanel() {
      JPanel panel = new JPanel(new GridLayout(1, 2, 8, 8));
      panel.add(this.makePathAttributesPanel());
      panel.add(this.makeInteriorAttributesPanel());

      return panel;
    }
示例#10
0
  /**
   * builds and displays the frame without the colored fractal; registers the buttons; sets size,
   * location, close operation; calls changeFractal()
   */
  private void makeWindow() {

    // set size and location
    setSize(740, 800);
    setLocation(100, 0);

    // specify close button action
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // instantiate panel
    panelNorth = new JPanel();

    // instantiate buttons and register action listener
    up = new JButton("level up");
    down = new JButton("level down");
    up.addActionListener(this);
    down.addActionListener(this);

    // set layout
    setLayout(new BorderLayout(10, 10));

    // add panel to frame and buttons to panel
    add(panelNorth, BorderLayout.NORTH);
    panelNorth.add(up);
    panelNorth.add(down);

    // call changeFractal
    changeFractal();
  }
 ToolAdaptersManagementDialog(AppContext appContext, String title, String helpID) {
   super(appContext.getApplicationWindow(), title, 0, helpID);
   this.appContext = appContext;
   JPanel contentPanel = createContentPanel();
   setContent(contentPanel);
   super.getJDialog().setMinimumSize(contentPanel.getPreferredSize());
 }
示例#12
0
 /** Show/update/hide page number field, according to loading policy and current data length. */
 public final void updatePageNumber(int pageNr) {
   controlPageNr.setValue(new Integer(pageNr));
   pageNrPanel.removeAll();
   if (pageNr > 0 && showPageNumber) pageNrPanel.add(controlPageNr);
   pageNrPanel.revalidate();
   this.repaint();
 }
  FactoryManagerGUI(FactoryManager parent, int pWidth, int pHeight) {
    this.parent = parent;
    this.PAGE_WIDTH = pWidth;
    this.PAGE_HEIGHT = pHeight;

    // initialize class variables
    activeKitsContainer = new JPanel();
    activeKitsPanel = new JPanel();
    kitDataPanel = new JPanel();
    kits = new TreeMap<Integer, Kits>();
    buildInfo = new ArrayList<Kits>();
    images = parent.getImageArray();
    greyLine = BorderFactory.createLineBorder(Color.DARK_GRAY);

    // build Active Kits Container
    activeKitsContainer.setLayout(new BoxLayout(activeKitsContainer, BoxLayout.X_AXIS));
    setComponentSize(activeKitsContainer, PAGE_WIDTH, PAGE_HEIGHT);
    setComponentSize(kitDataPanel, 450, PAGE_HEIGHT);
    buildActiveKits(activeKitsPanel);
    activeKitsContainer.add(activeKitsPanel);
    activeKitsContainer.add(kitDataPanel);

    // add master containers to frame
    this.add(activeKitsContainer);
  }
示例#14
0
  public MainPanel() {
    super(new BorderLayout());
    JPanel p = new JPanel(new GridLayout(2, 1));
    final JComboBox<String> c0 = makeComboBox(true, false);
    final JComboBox<String> c1 = makeComboBox(false, false);
    final JComboBox<String> c2 = makeComboBox(true, true);
    final JComboBox<String> c3 = makeComboBox(false, true);

    p.add(makeTitlePanel("setEditable(false)", Arrays.asList(c0, c1)));
    p.add(makeTitlePanel("setEditable(true)", Arrays.asList(c2, c3)));
    p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(p, BorderLayout.NORTH);
    add(
        new JButton(
            new AbstractAction("add") {
              @Override
              public void actionPerformed(ActionEvent e) {
                String str = new Date().toString();
                for (JComboBox<String> c : Arrays.asList(c0, c1, c2, c3)) {
                  MutableComboBoxModel<String> m = (MutableComboBoxModel<String>) c.getModel();
                  m.insertElementAt(str, m.getSize());
                }
              }
            }),
        BorderLayout.SOUTH);
    setPreferredSize(new Dimension(320, 240));
  }
示例#15
0
  public AboutDialog(View view) {
    super(view, jEdit.getProperty("about.title"), true);

    JPanel content = new JPanel(new BorderLayout());
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    content.add(BorderLayout.CENTER, new AboutPanel());

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.setBorder(new EmptyBorder(12, 0, 0, 0));

    buttonPanel.add(Box.createGlue());
    close = new JButton(jEdit.getProperty("common.close"));
    close.addActionListener(new ActionHandler());
    getRootPane().setDefaultButton(close);
    buttonPanel.add(close);
    buttonPanel.add(Box.createGlue());
    content.add(BorderLayout.SOUTH, buttonPanel);

    pack();
    setResizable(false);
    setLocationRelativeTo(view);
    show();
  }
示例#16
0
文件: Server.java 项目: w4-pwr/studia
  Server() {
    setSize(500, 100);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    thread = new Thread(this);
    clientList = new ArrayList<ClientData>();
    sList = new ArrayList<ServerThread>();
    JPanel panel = new JPanel();
    panel.add(new JLabel("Port :"));
    portText = new JTextField(5);
    portText.setText("7777");
    panel.add(portText);
    startButton = new JButton("Start server");
    startButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            try {
              port = Integer.parseInt(portText.getText());
              thread.start();
              startButton.setEnabled(false);
            } catch (NumberFormatException ex) {
              JOptionPane.showMessageDialog(null, "B³êdny format numeru portu");
              portText.setText("");
            }
          }
        });
    panel.add(startButton);
    l = new JLabel("Serwer jest nieaktywny");
    panel.add(l);
    add(panel, BorderLayout.NORTH);
  }
示例#17
0
  /** Creates the attribute choices. Override to add additional choices. */
  protected void createAttributeChoices(JPanel panel) {
    panel.add(new JLabel("Fill"));
    fFillColor = createColorChoice("FillColor");
    panel.add(fFillColor);

    panel.add(new JLabel("Text"));
    fTextColor = createColorChoice("TextColor");
    panel.add(fTextColor);

    panel.add(new JLabel("Pen"));
    fFrameColor = createColorChoice("FrameColor");
    panel.add(fFrameColor);

    panel.add(new JLabel("Arrow"));
    CommandChoice choice = new CommandChoice();
    fArrowChoice = choice;
    choice.addItem(
        new ChangeAttributeCommand(
            "none", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_NONE), this));
    choice.addItem(
        new ChangeAttributeCommand(
            "at Start", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_START), this));
    choice.addItem(
        new ChangeAttributeCommand(
            "at End", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_END), this));
    choice.addItem(
        new ChangeAttributeCommand(
            "at Both", "ArrowMode", new Integer(PolyLineFigure.ARROW_TIP_BOTH), this));
    panel.add(fArrowChoice);

    panel.add(new JLabel("Font"));
    fFontChoice = createFontChoice();
    panel.add(fFontChoice);
  }
示例#18
0
  private JPanel initServerChoice() {

    JPanel p = new JPanel();
    p.setLayout(new GridLayout(6, 1, 5, 2));
    p.add(new JLabel("Search At: "));

    chosenServer.setText(server.getHost().getHostName());
    p.add(chosenServer);
    chosenServer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            try {
              InetAddress newHost = InetAddress.getByName(chosenServer.getText());
              Whois newServer = new Whois(newHost);
              server = newServer;
            } catch (Exception e) {
              // should use an error dialog here, but that
              // doesn't teach much about networking
              chosenServer.setText(server.getHost().getHostName());
            }
          }
        });

    return p;
  }
  // -------------------------------------------------------------------------------------- //
  // ---------------------------------- Constructor Helpers ------------------------------- //
  // -------------------------------------------------------------------------------------- //
  private void buildActiveKits(JPanel container) {
    // initialize variable
    final int WIDTH = 150;

    // set containment panel properties
    container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
    setComponentSize(container, 150, PAGE_HEIGHT);

    JLabel header = new JLabel("Active Kits");
    header.setHorizontalAlignment(header.CENTER);
    header.setFont(new Font("Serif", Font.BOLD, 18));
    setComponentSize(header, WIDTH, 25);

    // create list model and list
    listModel = new DefaultListModel();
    kitList = new JList(listModel);
    kitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    kitList.addListSelectionListener(this);
    kitList.setFixedCellHeight(25);
    JScrollPane listScrollPane = new JScrollPane(kitList);

    // add elements to containment panel
    container.add(header);
    container.add(listScrollPane);
  }
示例#20
0
 Main() {
   f = new JFrame("Wiki Seach");
   JPanel p = new JPanel();
   JPanel p1 = new JPanel();
   b = new JButton("Search");
   b1 = new JButton("Exit");
   t = new JTextField(30);
   b.addActionListener(this);
   b1.addActionListener(this);
   p1.add(b);
   p1.add(b1);
   p.add(t);
   f.setLayout(new GridLayout(2, 1));
   f.add(p);
   f.add(p1);
   f.pack();
   f.setLocationRelativeTo(null);
   f.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   f.setVisible(true);
 }
示例#21
0
 public void createPanel() {
   panel = new JPanel(new GridLayout(3, 1)); // A panel object is created;
   panel.setBackground(Color.GREEN); // Set the background color of the panel
   panel.add(buttonPlus); // Add the button object to the panel
   panel.add(buttonMinus); // and the other one also.
   panel.add(text); // Add the text object to the panel.
 }
示例#22
0
  private JPanel getMainPanel() {
    if (mainPanel == null) {
      mainPanel = new JPanel();
      mainPanel.setPreferredSize(new Dimension(550, 300));
      GridBagLayout layout = new GridBagLayout();

      mainPanel.setLayout(layout);

      GridBagConstraints constraints = new GridBagConstraints();

      constraints.fill = GridBagConstraints.BOTH;
      constraints.weightx = 2;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.gridwidth = 2;
      layout.setConstraints(getAvailableRobotsPanel(), constraints);
      mainPanel.add(getAvailableRobotsPanel());
      constraints.gridwidth = 1;
      constraints.weightx = 0;
      constraints.weighty = 0;
      constraints.anchor = GridBagConstraints.CENTER;
      layout.setConstraints(getButtonsPanel(), constraints);
      mainPanel.add(getButtonsPanel());
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.weightx = 1;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      layout.setConstraints(getSelectedRobotsPanel(), constraints);
      mainPanel.add(getSelectedRobotsPanel());
    }
    return mainPanel;
  }
示例#23
0
  public void enableControlPanel() {
    boolean bVisible = false;

    int nmembers = buttonPane.getComponentCount();
    for (int k = 0; k < nmembers; k++) {
      Component comp = buttonPane.getComponent(k);
      if (comp != null) {
        if (comp.isVisible() || comp.isEnabled()) {
          bVisible = true;
          break;
        }
      }
    }

    if (bVisible && !buttonPane.isVisible()) {
      Dimension dim = getSize();
      Dimension dim1 = buttonPane.getPreferredSize();
      int w = dim.width;
      int h = dim.height + dim1.height;
      if (dim1.width > w) w = dim1.width;
      if (w < 300) w = 300;
      if (h < 200) h = 200;
      setSize(w, h);
    }
    buttonPane.setVisible(bVisible);
  }
示例#24
0
 public RemoveFrame() {
   frame = new JFrame("Select Files you wish to Remove from Drive");
   frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
   frame.getRootPane().setDefaultButton(confirm);
   try {
     files = DriveList.list();
   } catch (IOException e) {
     files = new ArrayList<File>();
   }
   confirm = new JButton("Remove");
   quit = new JButton("Cancel");
   confirm.addActionListener(this);
   quit.addActionListener(this);
   frame.setLayout(new BorderLayout());
   checkPanel = new JPanel();
   control = new JPanel();
   control.setLayout(new GridLayout(1, 2));
   control.add(confirm);
   control.add(quit);
   frame.add(control, BorderLayout.SOUTH);
   drawCheckPanel();
   frame.add(checkPanel, BorderLayout.CENTER);
   frame.pack();
   frame.setVisible(true);
 }
示例#25
0
文件: SetMap.java 项目: kkmehra/SE
  public void newframe() {
    JFrame frame = new JFrame("Cab Service ");
    frame.setSize(800, 600);

    frame.setVisible(true);
    // frame.setBackground(Color.CYAN);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton jb = new JButton("Set Name of Places ");
    jb.setBounds(100, 100, 20, 50);

    JPanel jp = new JPanel();
    jp.setBackground(Color.gray);
    jp.add(jb);
    frame.add(jp);
    JPanel jp1 = new JPanel();
    jp1.setBackground(Color.gray);
    frame.add(jp1);

    frame.add(jp);
    jb.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            try {
              CreateFrame();

            } catch (IOException ex) {
              Logger.getLogger(SetMap.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        });
  }
  /**
   * Builds reading lists tab.
   *
   * @return component.
   */
  protected JComponent buildReadingListsTab() {
    // Wording
    JComponent wording = msg(Strings.message("guide.dialog.readinglists.wording"));

    // Buttons
    Dimension btnSize = new Dimension(20, 20);
    btnAddReadingList.setPreferredSize(btnSize);
    btnRemoveList.setPreferredSize(btnSize);
    FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
    JPanel bbar = new JPanel(layout);
    bbar.add(btnAddReadingList);
    bbar.add(btnRemoveList);
    layout.setHgap(0);
    layout.setVgap(0);

    // Panel
    BBFormBuilder builder = new BBFormBuilder("0:grow");
    builder.setDefaultDialogBorder();

    builder.append(wording);
    builder.appendUnrelatedComponentsGapRow(2);
    builder.appendRow("min:grow");
    builder.append(new JScrollPane(tblReadingLists), 1, CellConstraints.FILL, CellConstraints.FILL);
    builder.append(bbar);

    return builder.getPanel();
  }
 private JComponent createRecentProjects() {
   JPanel panel = new JPanel(new BorderLayout());
   panel.add(new NewRecentProjectPanel(this), BorderLayout.CENTER);
   panel.setBackground(getProjectsBackground());
   panel.setBorder(new CustomLineBorder(getSeparatorColor(), JBUI.insetsRight(1)));
   return panel;
 }
示例#28
0
  private void initialize() {
    setName("JunkPanel");
    setLayout(new GridBagLayout());
    refreshLanguage();

    // Adds all of the components
    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.WEST;
    final Insets insets5555 = new Insets(5, 5, 5, 5);
    constraints.insets = insets5555;
    constraints.weightx = 1.0;
    constraints.gridwidth = 1;
    constraints.gridy = 0;

    constraints.insets = insets5555;
    constraints.gridx = 0;

    add(hideJunkMessagesCheckBox, constraints);

    constraints.gridy++;

    add(markJunkIdentityBadCheckBox, constraints);

    constraints.gridy++;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    {
      final JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);
      add(separator, constraints);
    }
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridy++;

    add(stopBoardUpdatesWhenDosedCheckBox, constraints);

    constraints.gridy++;

    {
      final JPanel subPanel = new JPanel(new GridBagLayout());
      final GridBagConstraints subConstraints = new GridBagConstraints();
      subConstraints.insets = new Insets(0, 10, 0, 10);
      subConstraints.anchor = GridBagConstraints.WEST;
      subConstraints.gridx = 0;
      subPanel.add(LinvalidSubsequentMessagesThreshold, subConstraints);
      subConstraints.gridx = 1;
      subPanel.add(TfInvalidSubsequentMessagesThreshold, subConstraints);

      add(subPanel, constraints);
    }

    // glue
    constraints.gridy++;
    constraints.gridx = 0;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    constraints.weighty = 1;
    add(new JLabel(""), constraints);

    // Add listeners
    stopBoardUpdatesWhenDosedCheckBox.addActionListener(listener);
  }
  public UpgradesPanel(ORUIManager orUIManager) {
    super(BoxLayout.Y_AXIS);

    this.orUIManager = orUIManager;

    preferredSize = new Dimension((int) Math.round(100 * (2 + Scale.getFontScale()) / 3), 200);
    setSize(preferredSize);
    setVisible(true);

    upgradePanel = new JPanel();

    upgradePanel.setOpaque(true);
    upgradePanel.setBackground(Color.DARK_GRAY);
    upgradePanel.setBorder(border);
    upgradePanel.setLayout(new GridLayout(defaultNbPanelElements, 1));

    scrollPane = new JScrollPane(upgradePanel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setSize(getPreferredSize());

    doneButton.setActionCommand("Done");
    doneButton.setMnemonic(KeyEvent.VK_D);
    doneButton.addActionListener(this);
    cancelButton.setActionCommand("Cancel");
    cancelButton.setMnemonic(KeyEvent.VK_C);
    cancelButton.addActionListener(this);

    add(scrollPane);
  }
示例#30
0
  void install() {
    Vector components = new Vector();
    Vector indicies = new Vector();
    int size = 0;

    JPanel comp = selectComponents.comp;
    Vector ids = selectComponents.filesets;

    for (int i = 0; i < comp.getComponentCount(); i++) {
      if (((JCheckBox) comp.getComponent(i)).getModel().isSelected()) {
        size += installer.getIntegerProperty("comp." + ids.elementAt(i) + ".real-size");
        components.addElement(installer.getProperty("comp." + ids.elementAt(i) + ".fileset"));
        indicies.addElement(new Integer(i));
      }
    }

    String installDir = chooseDirectory.installDir.getText();

    Map osTaskDirs = chooseDirectory.osTaskDirs;
    Iterator keys = osTaskDirs.keySet().iterator();
    while (keys.hasNext()) {
      OperatingSystem.OSTask osTask = (OperatingSystem.OSTask) keys.next();
      String dir = ((JTextField) osTaskDirs.get(osTask)).getText();
      if (dir != null && dir.length() != 0) {
        osTask.setEnabled(true);
        osTask.setDirectory(dir);
      } else osTask.setEnabled(false);
    }

    InstallThread thread =
        new InstallThread(installer, progress, installDir, osTasks, size, components, indicies);
    progress.setThread(thread);
    thread.start();
  }