private OffsetPanel(Component comp) {
   this.setLayout(new BorderLayout(0, 0));
   TitledBorder tb = BorderFactory.createTitledBorder(b.getString("kOffsetBy"));
   if (JOAConstants.ISMAC) {
     // tb.setTitleFont(new Font("Helvetica", Font.PLAIN, 11));
   }
   this.setBorder(tb);
   JPanel controls = new JPanel();
   controls.setLayout(new GridLayout(3, 1, 5, 0));
   b1 = new JOAJRadioButton(b.getString("kSequence"));
   b2 = new JOAJRadioButton(b.getString("kDistance"), true);
   b3 = new JOAJRadioButton(b.getString("kTime"));
   controls.add(b2);
   controls.add(b1);
   controls.add(b3);
   controls.add(new JOAJLabel("       "));
   ButtonGroup bg = new ButtonGroup();
   bg.add(b1);
   bg.add(b2);
   bg.add(b3);
   this.add("Center", controls);
   b1.addItemListener((ItemListener) comp);
   b2.addItemListener((ItemListener) comp);
   b3.addItemListener((ItemListener) comp);
 }
Example #2
0
  public LibTypePanel() {
    super(new FlowLayout());

    JLabel label = new JLabel("Add as a module or project level library?");
    add(label);
    moduleRadio = new JRadioButton("Module");
    JRadioButton projectRadio = new JRadioButton("Project");
    ButtonGroup bg = new ButtonGroup();
    bg.add(moduleRadio);
    bg.add(projectRadio);
    moduleRadio.setSelected(true);
    add(moduleRadio);
    add(projectRadio);

    projectRadio.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (!hasProjectLibWarningBeenShown) {
              hasProjectLibWarningBeenShown = true;
              Messages.showInfoMessage(
                  LibTypePanel.this,
                  "When adding at the project level, the library defaults as inactive for all modules.  You must manually go to Settings->Modules->Libraries afterwards to activate.",
                  "Jar Juggler");
            }
          }
        });
  }
  public MapDesigner(int row, int col) {
    this.row = row; // 設置行數
    this.col = col; // 設置列數	
    this.setTitle("3D迷宮重力球地圖設計器"); // 設置標題
    icrystal = new ImageIcon("img/Diamond.png").getImage(); // 圓孔的標誌圖
    mdp = new MapDesignPanel(row, col, this); // 創建地圖設計器面板
    jsp = new JScrollPane(mdp); // 創建JScrollPane面板

    this.add(jsp); // 添加JScrollPane面板

    jp.add(jbGenerate); // 添加生成地圖按鈕
    jp.add(jbGenerateD); // 添加生成圓孔按鈕
    jp.add(jrBlack);
    bg.add(jrBlack); // 向jp中添加黑色單選按鈕
    jp.add(jrWhite);
    bg.add(jrWhite); // 向jp中添加白色單選按鈕
    jp.add(jrCrystal);
    bg.add(jrCrystal); // 向jp中添加圓孔單選按鈕
    this.add(jp, BorderLayout.NORTH); // jp添加進窗體中
    jbGenerate.addActionListener(this); // 生成地圖按鈕設置監聽
    jbGenerateD.addActionListener(this); // 生成圓孔按鈕設置監聽
    this.setBounds(10, 10, 800, 600); // 設置窗口大小
    this.setVisible(true); // 設置可見
    this.mdp.requestFocus(true); // MapDesignPanel獲取焦點
  }
  /**
   * Adds a JLabel and three JRadioButton instances in a ButtonGroup to the given panel with a
   * GridBagLayout, and returns the buttons in an array.
   */
  private JRadioButton[] addRadioButtonTriplet(String labelText, JPanel panel) {
    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.anchor = GridBagConstraints.WEST;
    labelConstraints.insets = new Insets(2, 10, 2, 10);

    GridBagConstraints buttonConstraints = new GridBagConstraints();
    buttonConstraints.insets = labelConstraints.insets;

    GridBagConstraints lastGlueConstraints = new GridBagConstraints();
    lastGlueConstraints.gridwidth = GridBagConstraints.REMAINDER;
    lastGlueConstraints.weightx = 1.0;

    // Create the radio buttons.
    JRadioButton radioButton0 = new JRadioButton();
    JRadioButton radioButton1 = new JRadioButton();
    JRadioButton radioButton2 = new JRadioButton();

    // Put them in a button group.
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(radioButton0);
    buttonGroup.add(radioButton1);
    buttonGroup.add(radioButton2);

    // Add the label and the buttons to the panel.
    panel.add(new JLabel(labelText), labelConstraints);
    panel.add(radioButton0, buttonConstraints);
    panel.add(radioButton1, buttonConstraints);
    panel.add(radioButton2, buttonConstraints);
    panel.add(Box.createGlue(), lastGlueConstraints);

    return new JRadioButton[] {radioButton0, radioButton1, radioButton2};
  }
Example #5
0
  @Override
  public JPopupMenu getComponentPopupMenu() {
    if (popupMenu == null) {
      popupMenu = new JPopupMenu(Messages.CHART_COLON);
      timeRangeMenu = new JMenu(Messages.PLOTTER_TIME_RANGE_MENU);
      timeRangeMenu.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_TIME_RANGE_MENU));
      popupMenu.add(timeRangeMenu);
      menuRBs = new JRadioButtonMenuItem[rangeNames.length];
      ButtonGroup rbGroup = new ButtonGroup();
      for (int i = 0; i < rangeNames.length; i++) {
        menuRBs[i] = new JRadioButtonMenuItem(rangeNames[i]);
        rbGroup.add(menuRBs[i]);
        menuRBs[i].addActionListener(this);
        if (viewRange == rangeValues[i]) {
          menuRBs[i].setSelected(true);
        }
        timeRangeMenu.add(menuRBs[i]);
      }

      popupMenu.addSeparator();

      saveAsMI = new JMenuItem(Messages.PLOTTER_SAVE_AS_MENU_ITEM);
      saveAsMI.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_SAVE_AS_MENU_ITEM));
      saveAsMI.addActionListener(this);
      popupMenu.add(saveAsMI);
    }
    return popupMenu;
  }
  private Component createChartSelectorButtonPane() {
    final ChartType[] types = ChartType.values();
    final ButtonGroup buttonGroup = new ButtonGroup();
    final JPanel buttonCarrier = new JPanel();
    buttonCarrier.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));

    for (int i = 0; i < types.length; i++) {
      final ChartType type = types[i];

      final SelectChartExpressionAction action =
          new SelectChartExpressionAction(type.getExpressionType());
      editModel.getChartExpressionsModel().addListDataListener(action);

      final ActionToggleButton button = new ActionToggleButton();
      button.putClientProperty("hideActionText", Boolean.TRUE); // NON-NLS
      button.setAction(action);
      button.setBorder(new EmptyBorder(0, 0, 0, 0));
      buttonGroup.add(button);
      buttonCarrier.add(button);
    }

    final JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(buttonCarrier, BorderLayout.NORTH);
    return panel;
  }
  /** Return a menu for DesktopWindow and add a special listener. */
  public static JMenu getCurrencyMenu(ActionListener listener) {
    JRadioButtonMenuItem menuItem;
    String defaultCurrency = Money.getCurrencyFor(Money.getDefaultCurrency());

    JMenu menu = new JMenu("Währung");
    ButtonGroup group = new ButtonGroup();

    JMenu europeanMenu = new JMenu("Europa");
    String europeanCurrencies[] = Money.getEuropeanCurrencyList();

    for (int i = 0; i < europeanCurrencies.length; i++) {
      menuItem = new RadioCurrencyMenuItem(europeanCurrencies[i]);
      menuItem.addActionListener(listener);
      europeanMenu.add(menuItem);

      group.add(menuItem);

      if (europeanCurrencies[i].startsWith(defaultCurrency)) {
        menuItem.setSelected(true);
      }

      if (i == 0) {
        europeanMenu.addSeparator();
      }
    }

    menu.add(europeanMenu);

    return menu;
  }
  private JPanel createFieldPanel() {
    myDoNotReplaceRadioButton =
        new JBRadioButton(UIUtil.replaceMnemonicAmpersand("Do n&ot replace"));
    myReplaceFieldsInaccessibleInRadioButton =
        new JBRadioButton(
            UIUtil.replaceMnemonicAmpersand("Replace fields &inaccessible in usage context"));
    myReplaceAllFieldsRadioButton =
        new JBRadioButton(UIUtil.replaceMnemonicAmpersand("&Replace all fields"));

    myDoNotReplaceRadioButton.setFocusable(false);
    myReplaceFieldsInaccessibleInRadioButton.setFocusable(false);
    myReplaceAllFieldsRadioButton.setFocusable(false);

    final ButtonGroup group = new ButtonGroup();
    group.add(myDoNotReplaceRadioButton);
    group.add(myReplaceFieldsInaccessibleInRadioButton);
    group.add(myReplaceAllFieldsRadioButton);

    final JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(myDoNotReplaceRadioButton);
    panel.add(myReplaceFieldsInaccessibleInRadioButton);
    panel.add(myReplaceAllFieldsRadioButton);

    panel.setBorder(
        IdeBorderFactory.createTitledBorder(
            "Replace fields used in expression with their getters", true));
    return panel;
  }
Example #9
0
  SurveyPanel(String ques, String[] resp, int def) {
    super();
    setSize(160, 110);
    question = new JLabel(ques);
    response = new JRadioButton[resp.length];
    JPanel sub1 = new JPanel();
    ButtonGroup group = new ButtonGroup();
    JLabel quesLabel = new JLabel(ques);
    sub1.add(quesLabel);
    JPanel sub2 = new JPanel();
    for (int i = 0; i < resp.length; i++) {

      if (def == i) {

        response[i] = new JRadioButton(resp[i], true);
      } else {
        response[i] = new JRadioButton(resp[i], false);
      }

      group.add(response[i]);
      sub2.add(response[i]);
    }

    JPanel sub3 = new JPanel();
    nextButton.setEnabled(true);
    sub3.add(nextButton);
    finalButton.setEnabled(false);
    sub3.add(finalButton);
    GridLayout grid = new GridLayout(3, 1);
    setLayout(grid);
    add(sub1);
    add(sub2);
    add(sub3);
  }
Example #10
0
  private JPanel createFoodTypeButtons(String[] array) {

    JPanel radioPanel = new JPanel();
    typeOfFood = new ArrayList<JRadioButton>();
    JRadioButton type0Radio = new JRadioButton(this.e.nonPerishableFood);
    JRadioButton type1Radio = new JRadioButton(this.e.perishableFood);

    typeOfFood.add(type0Radio);
    typeOfFood.add(type1Radio);

    type0Radio.setActionCommand(this.e.nonPerishableFood);
    type1Radio.setActionCommand(this.e.perishableFood);

    // Register a listener for the radio buttons.
    RadioListener myListener =
        new RadioListener(type0Radio, type1Radio, newCreatureButton, newJewelButton);
    type0Radio.addActionListener(myListener);
    type1Radio.addActionListener(myListener);

    // Group the radio buttons.
    group = new ButtonGroup();
    group.add(type0Radio);
    group.add(type1Radio);

    model = new DefaultButtonModel();
    group.setSelected(model, false);

    radioPanel.setLayout(new GridLayout(0, 1));
    radioPanel.add(type0Radio);
    radioPanel.add(type1Radio);

    return radioPanel;
  }
  /**
   * Creates the theme menu
   *
   * @return the theme menu
   */
  private JMenu createThemeMenu() {
    JMenu themeMenu = new JMenu("Theme");
    ButtonGroup buttonGroup = new ButtonGroup();

    // Create a menu item for all themes
    for (int i = 0; i < themes.length; i++) {
      JMenuItem themeItem = new JRadioButtonMenuItem(themes[i].getName());
      buttonGroup.add(themeItem);
      final int k = i;
      themeItem.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              // Apply the selected theme
              applyTheme(themes[k]);
            }
          });

      themeMenu.add(themeItem);

      // Set the first item (default theme) to be selected
      themeItem.setSelected(i == 0);
    }

    return themeMenu;
  }
  // -----------------------------------------------------------------
  //  Sets up a panel with a label and a set of radio buttons
  //  that control its text.
  // -----------------------------------------------------------------
  public QuoteOptionsPanel() {
    comedyQuote = "Take my wife, please.";
    philosophyQuote = "I think, therefore I am.";
    carpentryQuote = "Measure twice. Cut once.";

    quote = new JLabel(comedyQuote);
    quote.setFont(new Font("Helvetica", Font.BOLD, 24));
    comedy = new JRadioButton("Comedy", true);
    comedy.setBackground(Color.green);
    philosophy = new JRadioButton("Philosophy");
    philosophy.setBackground(Color.green);
    carpentry = new JRadioButton("Carpentry");
    carpentry.setBackground(Color.green);

    ButtonGroup group = new ButtonGroup();
    group.add(comedy);
    group.add(philosophy);
    group.add(carpentry);

    QuoteListener listener = new QuoteListener();
    comedy.addActionListener(listener);
    philosophy.addActionListener(listener);
    carpentry.addActionListener(listener);

    add(quote);
    add(comedy);
    add(philosophy);
    add(carpentry);

    setBackground(Color.green);
    setPreferredSize(new Dimension(300, 100));
  }
 /** 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();
 }
  public void createPopupMenu() {
    super.createPopupMenu();

    JPopupMenu popupMenu = getPopupMenu();
    if (popupMenu == null) {
      popupMenu = new JPopupMenu();
      setPopupMenu(popupMenu);
    } else {
      popupMenu.addSeparator();
    }

    propertiesItem = new JMenuItem("Properties ...");

    propertiesItem.addActionListener(this);
    propertiesItem.setMnemonic('s');
    popupMenu.add(propertiesItem);

    popupMenu.addSeparator();
    ButtonGroup group = new ButtonGroup();
    inItem = new JRadioButtonMenuItem("IN");
    group.add(inItem);
    inItem.addActionListener(this);
    popupMenu.add(inItem);
    outItem = new JRadioButtonMenuItem("OUT");
    group.add(outItem);
    outItem.addActionListener(this);
    popupMenu.add(outItem);
    inoutItem = new JRadioButtonMenuItem("INOUT");
    group.add(inoutItem);
    inoutItem.addActionListener(this);
    popupMenu.add(inoutItem);
  }
Example #15
0
  private JPanel createRadioButtonPanel() {

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(1, 3));

    middleButton = new JRadioButton("Middle Page");
    middleButton.setHorizontalAlignment(AbstractButton.CENTER);
    middleButton.setActionCommand(Page.MIDDLE);
    middleButton.setEnabled(false);

    endButton = new JRadioButton("End Page");
    endButton.setHorizontalAlignment(AbstractButton.CENTER);
    endButton.setActionCommand(Page.END);
    endButton.setEnabled(false);

    initButton = new JRadioButton("Start Page");
    initButton.setHorizontalAlignment(AbstractButton.CENTER);
    initButton.setActionCommand(Page.START);
    initButton.setEnabled(false);

    ButtonGroup group = new ButtonGroup();
    group.add(initButton);
    group.add(middleButton);
    group.add(endButton);

    buttonPanel.add(initButton);
    buttonPanel.add(middleButton);
    buttonPanel.add(endButton);
    buttonPanel.setBorder(BorderFactory.createEtchedBorder());

    return buttonPanel;
  }
  public PatternBackgroundQuickPane() {
    this.setLayout(new BorderLayout(0, 4));

    JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
    this.add(contentPane, BorderLayout.NORTH);
    contentPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));

    JPanel typePane2 = new JPanel();
    contentPane.add(typePane2);
    typePane2.setLayout(new GridLayout(0, 8, 1, 1));
    typePane2.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    ButtonGroup patternButtonGroup = new ButtonGroup();
    patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT];
    for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) {
      patternButtonArray[i] = new PatternButton(i);
      patternButtonGroup.add(patternButtonArray[i]);
      typePane2.add(patternButtonArray[i]);
    }

    JPanel colorPane = new JPanel(new GridLayout(0, 2));
    foregroundColorPane = new ColorSelectBox(70);
    backgroundColorPane = new ColorSelectBox(70);
    foregroundColorPane.setSelectObject(Color.lightGray);
    backgroundColorPane.setSelectObject(Color.black);

    colorPane.add(
        this.createLabelColorPane(Inter.getLocText("Foreground") + ":", foregroundColorPane));
    colorPane.add(
        this.createLabelColorPane(Inter.getLocText("Background") + ":", backgroundColorPane));
    this.add(colorPane, BorderLayout.CENTER);
    foregroundColorPane.addSelectChangeListener(colorChangeListener);
    backgroundColorPane.addSelectChangeListener(colorChangeListener);
  }
Example #17
0
  private JPanel getJContentPane() {
    if (jContentPane == null) {
      jLabel6 = new JLabel();
      jLabel6.setBounds(new Rectangle(11, 72, 218, 19));
      jLabel6.setText("Install log directory:");
      jLabel5 = new JLabel();
      jLabel5.setBounds(new Rectangle(11, 2, 394, 26));
      jLabel5.setText("Advanced Install. Please select your preferences");
      ButtonGroup group = new ButtonGroup();
      pathSuffix = new JTextArea();
      pathSuffix.setBounds(new Rectangle(232, 48, 61, 21));
      pathSuffix.setText("BIRCH");
      jLabel4 = new JLabel();
      jLabel4.setBounds(new Rectangle(22, 351, 312, 20));
      jLabel4.setText("* - Automatically detected, recommended.");
      jLabel3 = new JLabel();
      jLabel3.setBounds(new Rectangle(220, 48, 10, 21));
      jLabel3.setText(" /");
      jLabel2 = new JLabel();
      jLabel2.setBounds(new Rectangle(18, 250, 132, 18));
      jLabel2.setText("Binaries:");
      jLabel1 = new JLabel();
      jLabel1.setBounds(new Rectangle(11, 115, 127, 21));
      jLabel1.setText("Framework Type:");
      jLabel = new JLabel();
      jLabel.setBounds(new Rectangle(11, 28, 131, 17));
      jLabel.setText("Install directory:");
      jContentPane = new JPanel();
      jContentPane.setLayout(null);
      jContentPane.setSize(new Dimension(464, 376));
      jContentPane.add(jLabel, null);
      jContentPane.add(getJButton(), null);
      jContentPane.add(getJTextArea(), null);
      jContentPane.add(jLabel3, null);
      jContentPane.add(pathSuffix, null);
      jContentPane.add(jLabel1, null);
      jContentPane.add(getJCheckBox(), null);
      jContentPane.add(getJCheckBox1(), null);
      jContentPane.add(jLabel2, null);
      jContentPane.add(getJCheckBox2(), null);
      jContentPane.add(getJCheckBox3(), null);
      jContentPane.add(getJCheckBox4(), null);
      jContentPane.add(getJCheckBox5(), null);
      jContentPane.add(getJCheckBox6(), null);

      jContentPane.add(getLogTextField(), null);
      jContentPane.add(getLogButton(), null);
      jContentPane.add(jLabel4, null);
      jContentPane.add(getWindows32Checkbox(), null);
      jContentPane.add(getJRadioButton(), null);
      jContentPane.add(jLabel5, null);
      jContentPane.add(jLabel6, null);
      jContentPane.add(getGitRadioButton(), null);
      jContentPane.add(getGitComboBox(), null);
      group.add(releaseRadioButton);
      group.add(developmentRadioButton);
      group.add(gitRadioButton);
    }
    return jContentPane;
  }
  /** TabbedPaneDemo Constructor */
  public TabbedPaneDemo(SwingSet2 swingset) {
    // Set the title for this demo, and an icon used to represent this
    // demo inside the SwingSet2 app.
    super(swingset, "TabbedPaneDemo", "toolbar/JTabbedPane.gif");

    // create tab position controls
    JPanel tabControls = new JPanel();
    tabControls.add(new JLabel(getString("TabbedPaneDemo.label")));
    top = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.top")));
    left = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.left")));
    bottom = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.bottom")));
    right = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.right")));
    getDemoPanel().add(tabControls, BorderLayout.NORTH);

    group = new ButtonGroup();
    group.add(top);
    group.add(bottom);
    group.add(left);
    group.add(right);

    top.setSelected(true);

    top.addActionListener(this);
    bottom.addActionListener(this);
    left.addActionListener(this);
    right.addActionListener(this);

    // create tab
    tabbedpane = new JTabbedPane();
    getDemoPanel().add(tabbedpane, BorderLayout.CENTER);

    String name = getString("TabbedPaneDemo.laine");
    JLabel pix = new JLabel(createImageIcon("tabbedpane/laine.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.ewan");
    pix = new JLabel(createImageIcon("tabbedpane/ewan.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.hania");
    pix = new JLabel(createImageIcon("tabbedpane/hania.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.bounce");
    spin = new HeadSpin();
    tabbedpane.add(name, spin);

    tabbedpane
        .getModel()
        .addChangeListener(
            new ChangeListener() {
              public void stateChanged(ChangeEvent e) {
                SingleSelectionModel model = (SingleSelectionModel) e.getSource();
                if (model.getSelectedIndex() == tabbedpane.getTabCount() - 1) {
                  spin.go();
                }
              }
            });
  }
Example #19
0
  /** Creates the main pane of the dialog. */
  protected Component createPreferencesPane() {
    str = ResourceBundle.getBundle("org.pegadi.lister.PrefsDialogStrings");
    Box pane = new Box(BoxLayout.Y_AXIS);
    Border b;

    JPanel selectionPane = new JPanel();
    selectionPane.setLayout(new BoxLayout(selectionPane, BoxLayout.Y_AXIS));
    ButtonGroup selectionGroup = new ButtonGroup();
    b = BorderFactory.createTitledBorder(str.getString("selection_title"));
    selectionPane.setBorder(b);

    lastRadio = new JRadioButton(str.getString("selection_last"));
    selectionGroup.add(lastRadio);
    selectionPane.add(lastRadio);

    defaultRadio = new JRadioButton(str.getString("selection_default"));
    selectionGroup.add(defaultRadio);
    selectionPane.add(defaultRadio);

    pane.add(selectionPane);

    /**
     * **************************************************************** JPanel scorePanel = new
     * JPanel(new GridBagLayout()); b =
     * BorderFactory.createTitledBorder(str.getString("score_title")); scorePanel.setBorder(b);
     *
     * <p>scoreCheck = new JCheckBox(str.getString("score_label")); scorePanel.add(scoreCheck, new
     * GridBagConstraints2(0, 0, 2, 1, 1.0, 0.0 ,GridBagConstraints.NORTHWEST,
     * GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
     *
     * <p>scorePanel.add(new JLabel(str.getString("score_hi_label")), new GridBagConstraints2(0, 1,
     * 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5,
     * 5), 0, 0));
     *
     * <p>topScoreField = new JTextField(4); scorePanel.add(topScoreField, new
     * GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST,
     * GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
     *
     * <p>scorePanel.add(new JLabel(str.getString("score_day_label")), new GridBagConstraints2(0, 2,
     * 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5,
     * 5), 0, 0));
     *
     * <p>dayScoreField = new JTextField(4); scorePanel.add(dayScoreField, new
     * GridBagConstraints2(1, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST,
     * GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
     *
     * <p>scorePanel.add(new JLabel(str.getString("score_pers_label")), new GridBagConstraints2(0,
     * 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5,
     * 5), 0, 0));
     *
     * <p>personalScoreField = new JTextField(4); scorePanel.add(personalScoreField, new
     * GridBagConstraints2(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE,
     * new Insets(5, 5, 5, 5), 0, 0));
     *
     * <p>pane.add(scorePanel); ***************************************************************
     */
    return pane;
  }
  /** Builds the MenuBar */
  private void buildUI() {
    // Construct menu items
    JMenu lookAndFeel = new JMenu("Look and feel");
    JRadioButtonMenuItem nativeLaF = new JRadioButtonMenuItem("Native", true);
    JRadioButtonMenuItem javaLaF = new JRadioButtonMenuItem("Java (Metal)");
    JRadioButtonMenuItem motifLaF = new JRadioButtonMenuItem("Motif");
    JMenu help = new JMenu("Help");
    JMenuItem about = new JMenuItem("About");

    // Add menu items to menu bar
    add(lookAndFeel);
    lookAndFeel.add(nativeLaF);
    lookAndFeel.add(javaLaF);
    lookAndFeel.add(motifLaF);
    add(Box.createHorizontalGlue());
    add(help);
    help.add(about);

    // Add buttons to button group
    ButtonGroup laFGroup = new ButtonGroup();
    laFGroup.add(nativeLaF);
    laFGroup.add(javaLaF);
    laFGroup.add(motifLaF);

    // Set action listeners
    nativeLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, UIManager.getSystemLookAndFeelClassName());
            owner.pack();
          }
        });

    javaLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, UIManager.getCrossPlatformLookAndFeelClassName());
            owner.pack();
          }
        });

    motifLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, "com.sun.java.swing.plaf.motif.MotifLookAndFeel");
            owner.pack();
          }
        });

    about.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.showAboutDialog(owner);
          }
        });
  }
 public void closeCurrentButtonRun() {
   if (currentButtonRun.isEmpty()) {
     return;
   }
   ButtonGroup bg = new ButtonGroup();
   for (JRadioButton button : currentButtonRun) {
     bg.add(button);
   }
   currentButtonRun.clear();
 }
Example #22
0
 private ButtonGroup createButtonGroup() {
   ButtonGroup g1 = new ButtonGroup();
   for (int j = 0; j < 4; j++)
     for (int i = 0; i < 16; i++) {
       JRadioButtonMenuItem b = new JRadioButtonMenuItem(new PopupIcon(i + 16 * j));
       b.setSelectedIcon(null);
       b.addActionListener(this::doSelect);
       this.add(b);
       g1.add(b);
     }
   return g1;
 }
Example #23
0
 /**
  * Adds a radio button to select an algorithm.
  *
  * @param c the container into which to place the button
  * @param name the algorithm name
  * @param g the button group
  */
 public void addRadioButton(Container c, final String name, ButtonGroup g) {
   ActionListener listener =
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           setAlgorithm(name);
         }
       };
   JRadioButton b = new JRadioButton(name, g.getButtonCount() == 0);
   c.add(b);
   g.add(b);
   b.addActionListener(listener);
 }
Example #24
0
  private JMenuBar createMenuBar() {
    JMenu menu = new JMenu("Menu");

    disablingItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK));

    menu.add(disablingItem);
    menu.addSeparator();

    blurItem.setSelected(true);
    blurItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.ALT_MASK));
    menu.add(blurItem);

    embossItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, InputEvent.ALT_MASK));
    menu.add(embossItem);

    busyPainterItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, InputEvent.ALT_MASK));
    menu.add(busyPainterItem);

    ButtonGroup group = new ButtonGroup();
    group.add(blurItem);
    group.add(embossItem);
    group.add(busyPainterItem);

    ItemListener menuListener =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (blurItem.isSelected()) {
              //                    layer.setUI(blurUI);
            } else if (embossItem.isSelected()) {
              //                    layer.setUI(embossUI);
            } else if (busyPainterItem.isSelected()) {
              layer.setUI(busyPainterUI);
            }
          }
        };

    blurItem.addItemListener(menuListener);
    embossItem.addItemListener(menuListener);
    busyPainterItem.addItemListener(menuListener);

    //        embossUI.getUnlockButton().addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                disablingItem.doClick();
    //            }
    //        });

    JMenuBar bar = new JMenuBar();
    bar.add(menu);

    bar.add(new LafMenu());
    return bar;
  }
  protected JComponent createCenterPanel() {
    JPanel optionsPanel = new JPanel();
    optionsPanel.setBorder(new EmptyBorder(10, 0, 0, 0));
    optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));

    myRbInlineAll = new JRadioButton();
    myRbInlineAll.setText(getInlineAllText());
    myRbInlineAll.setSelected(true);
    myRbInlineThisOnly = new JRadioButton();
    myRbInlineThisOnly.setText(getInlineThisText());

    optionsPanel.add(myRbInlineAll);
    optionsPanel.add(myRbInlineThisOnly);
    ButtonGroup bg = new ButtonGroup();
    bg.add(myRbInlineAll);
    bg.add(myRbInlineThisOnly);
    new RadioUpDownListener(myRbInlineAll, myRbInlineThisOnly);

    myRbInlineThisOnly.setEnabled(myInvokedOnReference);
    final boolean writable = myElement.isWritable();
    myRbInlineAll.setEnabled(writable);
    if (myInvokedOnReference) {
      if (canInlineThisOnly()) {
        myRbInlineAll.setSelected(false);
        myRbInlineAll.setEnabled(false);
        myRbInlineThisOnly.setSelected(true);
      } else {
        if (writable) {
          final boolean inlineThis = isInlineThis();
          myRbInlineThisOnly.setSelected(inlineThis);
          myRbInlineAll.setSelected(!inlineThis);
        } else {
          myRbInlineAll.setSelected(false);
          myRbInlineThisOnly.setSelected(true);
        }
      }
    } else {
      myRbInlineAll.setSelected(true);
      myRbInlineThisOnly.setSelected(false);
    }

    getPreviewAction().setEnabled(myRbInlineAll.isSelected());
    myRbInlineAll.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            boolean enabled = myRbInlineAll.isSelected();
            getPreviewAction().setEnabled(enabled);
          }
        });
    return optionsPanel;
  }
  protected JPanel createReplaceFieldsWithGettersPanel() {
    JPanel radioButtonPanel = new JPanel(new GridBagLayout());

    GridBagConstraints gbConstraints = new GridBagConstraints();
    gbConstraints.insets = new Insets(4, 8, 4, 8);
    gbConstraints.weighty = 1;
    gbConstraints.weightx = 1;
    gbConstraints.gridy = 0;
    gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gbConstraints.fill = GridBagConstraints.BOTH;
    gbConstraints.anchor = GridBagConstraints.WEST;
    radioButtonPanel.add(
        new JLabel(
            RefactoringBundle.message("replace.fields.used.in.expressions.with.their.getters")),
        gbConstraints);

    myReplaceFieldsWithGettersNoneRadio = new JRadioButton();
    myReplaceFieldsWithGettersNoneRadio.setText(RefactoringBundle.message("do.not.replace"));

    myReplaceFieldsWithGettersInaccessibleRadio = new JRadioButton();
    myReplaceFieldsWithGettersInaccessibleRadio.setText(
        RefactoringBundle.message("replace.fields.inaccessible.in.usage.context"));

    myReplaceFieldsWithGettersAllRadio = new JRadioButton();
    myReplaceFieldsWithGettersAllRadio.setText(RefactoringBundle.message("replace.all.fields"));

    gbConstraints.gridy++;
    radioButtonPanel.add(myReplaceFieldsWithGettersNoneRadio, gbConstraints);
    gbConstraints.gridy++;
    radioButtonPanel.add(myReplaceFieldsWithGettersInaccessibleRadio, gbConstraints);
    gbConstraints.gridy++;
    radioButtonPanel.add(myReplaceFieldsWithGettersAllRadio, gbConstraints);

    final int currentSetting =
        JavaRefactoringSettings.getInstance().INTRODUCE_PARAMETER_REPLACE_FIELDS_WITH_GETTERS;

    myReplaceFieldsWithGettersButtonGroup.add(myReplaceFieldsWithGettersNoneRadio);
    myReplaceFieldsWithGettersButtonGroup.add(myReplaceFieldsWithGettersInaccessibleRadio);
    myReplaceFieldsWithGettersButtonGroup.add(myReplaceFieldsWithGettersAllRadio);

    if (currentSetting == IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL) {
      myReplaceFieldsWithGettersAllRadio.setSelected(true);
    } else if (currentSetting
        == IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE) {
      myReplaceFieldsWithGettersInaccessibleRadio.setSelected(true);
    } else if (currentSetting == IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE) {
      myReplaceFieldsWithGettersNoneRadio.setSelected(true);
    }

    return radioButtonPanel;
  }
 private void init() {
   primFocus = new JRadioButton();
   nullFocus = new JRadioButton();
   //    simFocus = new JRadioButton();
   //    showFocus = new JRadioButton();
   ButtonGroup group = new ButtonGroup();
   group.add(primFocus);
   group.add(nullFocus);
   //    group.add(simFocus);
   //    group.add(showFocus);
   tabbedPane = new JTabbedPaneX(JTabbedPane.TOP);
   //    graphView.setMinimumSize(new Dimension(200, 200));
   //    graphView.setPreferredSize(new Dimension(200, 200));
 }
Example #28
0
 public RadioButtons() {
   rb1.addActionListener(al);
   rb2.addActionListener(al);
   rb3.addActionListener(al);
   g.add(rb1);
   g.add(rb2);
   g.add(rb3);
   t.setEditable(false);
   setLayout(new FlowLayout());
   add(t);
   add(rb1);
   add(rb2);
   add(rb3);
 }
  /**
   * @param shortcut dialog will be initialized with this <code>shortcut</code>. It can be <code>
   *     null</code> if dialog is used to create new mouse shortcut.
   */
  public MouseShortcutDialog(
      JComponent parentComponent,
      MouseShortcut shortcut,
      @NotNull Keymap keymap,
      @NotNull String actiondId,
      @NotNull Group mainGroup) {
    super(parentComponent, true);
    setTitle(KeyMapBundle.message("mouse.shortcut.dialog.title"));

    myKeymap = keymap;
    myActionId = actiondId;
    myMainGroup = mainGroup;

    myRbSingleClick =
        new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.single.click.radio"));
    myRbDoubleClick =
        new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.double.click.radio"));
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(myRbSingleClick);
    buttonGroup.add(myRbDoubleClick);

    myLblPreview = new JLabel(" ");

    myClickPad = new MyClickPad();

    myTarConflicts = new JTextArea();
    myTarConflicts.setFocusable(false);
    myTarConflicts.setEditable(false);
    myTarConflicts.setBackground(UIUtil.getPanelBackground());
    myTarConflicts.setLineWrap(true);
    myTarConflicts.setWrapStyleWord(true);

    if (shortcut != null) {
      if (shortcut.getClickCount() == 1) {
        myRbSingleClick.setSelected(true);
      } else {
        myRbDoubleClick.setSelected(true);
      }
      myButton = shortcut.getButton();
      myModifiers = shortcut.getModifiers();
    } else {
      myRbSingleClick.setSelected(true);
      myButton = -1;
      myModifiers = -1;
    }

    updatePreviewAndConflicts();

    init();
  }
Example #30
0
  public NewGameDialog(GUI parent) {
    this.parent = parent;
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setTitle("New game");
    this.setSize(250, 150);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
    JPanel contentPane = new JPanel();
    this.add(contentPane);
    contentPane.setLayout(new FlowLayout()); // BoxLayout(contentPane, BoxLayout.PAGE_AXIS));

    SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 3, 1);
    JLabel numAIlabel = new JLabel("Number of opponents:");
    numAIlabel.setMaximumSize(numAIlabel.getPreferredSize());
    contentPane.add(numAIlabel);

    numAI = new JSpinner(model); /*{
            @Override
            public Dimension getMaximumSize() {
                Dimension dim = super.getMaximumSize();
                dim.height = getPreferredSize().height;
                return dim;
            }
        };*/
    numAI.setEditor(new JSpinner.DefaultEditor(numAI));
    numAI.setPreferredSize(new Dimension(100, 30));

    // numAI.setMaximumSize(numAI.getPreferredSize());

    contentPane.add(numAI);
    chooseDifficulty = new ButtonGroup();
    JRadioButton easy = new JRadioButton("Easy");
    JRadioButton intermediate = new JRadioButton("Intermediate");
    JRadioButton hard = new JRadioButton("Hard");
    easy.setActionCommand("EASY");
    intermediate.setActionCommand("INTERMEDIATE");
    hard.setActionCommand("HARD");
    chooseDifficulty.add(easy);
    chooseDifficulty.add(intermediate);
    chooseDifficulty.add(hard);
    contentPane.add(easy);
    contentPane.add(intermediate);
    contentPane.add(hard);
    easy.doClick();
    JButton confirm = new JButton("Confirm");
    contentPane.add(confirm);
    confirm.addActionListener(this);

    this.setVisible(true);
  }