示例#1
0
  HDTextureConfig() {
    comboListeners = new AnimationComboListener[4];
    comboListeners[0] = new AnimationComboListener(waterCombo, "Water");
    comboListeners[1] = new AnimationComboListener(lavaCombo, "Lava");
    comboListeners[2] = new AnimationComboListener(fireCombo, "Fire");
    comboListeners[3] = new AnimationComboListener(portalCombo, "Portal");

    waterCombo.addItemListener(comboListeners[0]);
    lavaCombo.addItemListener(comboListeners[1]);
    fireCombo.addItemListener(comboListeners[2]);
    portalCombo.addItemListener(comboListeners[3]);

    otherCombo.addItem("Not Animated");
    otherCombo.addItem("Custom Animated");
    otherCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              switch (otherCombo.getSelectedIndex()) {
                case 0:
                  MCPatcherUtils.set(MCPatcherUtils.HD_TEXTURES, "customOther", false);
                  break;

                case 1:
                  MCPatcherUtils.set(MCPatcherUtils.HD_TEXTURES, "customOther", true);
                  break;

                default:
                  break;
              }
            }
          }
        });

    textureCacheCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MCPatcherUtils.set(
                MCPatcherUtils.HD_TEXTURES, "useTextureCache", textureCacheCheckBox.isSelected());
          }
        });

    shrinkGLMemoryCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MCPatcherUtils.set(
                MCPatcherUtils.HD_TEXTURES, "reclaimGLMemory", shrinkGLMemoryCheckBox.isSelected());
          }
        });

    autoRefreshTexturesCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MCPatcherUtils.set(
                MCPatcherUtils.HD_TEXTURES,
                "autoRefreshTextures",
                autoRefreshTexturesCheckBox.isSelected());
          }
        });
  }
示例#2
0
 public CheckBoxes() {
   cb1.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           trace("1", cb1);
         }
       });
   cb2.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           trace("2", cb2);
         }
       });
   cb3.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           trace("3", cb3);
         }
       });
   setLayout(new FlowLayout());
   add(new JScrollPane(t));
   add(cb1);
   add(cb2);
   add(cb3);
 }
  /**
   * set new frame for this view We start listening for frame action/status and click events
   * instandly. If an event occurs, we use it to synchronize our controls with states of a (maybe)
   * new document view of this frame.
   *
   * @param xFrame the reference to the frame, which provides the possibility to get the required
   *     status information
   *     <p>Attention: We don't accept new frames here. We get one after startup and work with it.
   *     That's it!
   */
  public void setFrame(com.sun.star.frame.XFrame xFrame) {
    if (xFrame == null) return;

    // be listener for click events
    // They will toogle the UI controls.
    ClickListener aMenuBarHandler =
        new ClickListener(FEATUREURL_MENUBAR, FEATUREPROP_MENUBAR, xFrame);
    ClickListener aToolBarHandler =
        new ClickListener(FEATUREURL_TOOLBAR, FEATUREPROP_TOOLBAR, xFrame);
    ClickListener aObjectBarHandler =
        new ClickListener(FEATUREURL_OBJECTBAR, FEATUREPROP_OBJECTBAR, xFrame);

    m_cbMenuBar.addActionListener(aMenuBarHandler);
    m_cbToolBar.addActionListener(aToolBarHandler);
    m_cbObjectBar.addActionListener(aObjectBarHandler);

    // be frame action listener
    // The callback will update listener connections
    // for status updates automaticly!
    m_aMenuBarListener =
        new StatusListener(m_cbMenuBar, MENUBAR_ON, MENUBAR_OFF, xFrame, FEATUREURL_MENUBAR);
    m_aToolBarListener =
        new StatusListener(m_cbToolBar, TOOLBAR_ON, TOOLBAR_OFF, xFrame, FEATUREURL_TOOLBAR);
    m_aObjectBarListener =
        new StatusListener(
            m_cbObjectBar, OBJECTBAR_ON, OBJECTBAR_OFF, xFrame, FEATUREURL_OBJECTBAR);

    m_aMenuBarListener.startListening();
    m_aToolBarListener.startListening();
    m_aObjectBarListener.startListening();
  }
示例#4
0
  public GalaxyViewer(Settings settings, boolean animatorFrame) throws Exception {
    super("Stars GalaxyViewer");
    this.settings = settings;
    this.animatorFrame = animatorFrame;
    if (settings.gameName.equals("")) throw new Exception("GameName not defined in settings.");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    File dir = new File(settings.directory);
    File map = new File(dir, settings.getGameName() + ".MAP");
    if (map.exists() == false) {
      File f = new File(dir.getParentFile(), settings.getGameName() + ".MAP");
      if (f.exists()) map = f;
      else {
        String error = "Could not find " + map.getAbsolutePath() + "\n";
        error += "Export this file from Stars! (Only needs to be done one time pr game)";
        throw new Exception(error);
      }
    }
    Vector<File> mFiles = new Vector<File>();
    Vector<File> hFiles = new Vector<File>();
    for (File f : dir.listFiles()) {
      if (f.getName().toUpperCase().endsWith("MAP")) continue;
      if (f.getName().toUpperCase().endsWith("HST")) continue;
      if (f.getName().toUpperCase().startsWith(settings.getGameName() + ".M")) mFiles.addElement(f);
      else if (f.getName().toUpperCase().startsWith(settings.getGameName() + ".H"))
        hFiles.addElement(f);
    }
    if (mFiles.size() == 0) throw new Exception("No M-files found matching game name.");
    if (hFiles.size() == 0) throw new Exception("No H-files found matching game name.");
    parseMapFile(map);
    Vector<File> files = new Vector<File>();
    files.addAll(mFiles);
    files.addAll(hFiles);
    p = new Parser(files);
    calculateColors();

    // UI:
    JPanel cp = (JPanel) getContentPane();
    cp.setLayout(new BorderLayout());
    cp.add(universe, BorderLayout.CENTER);
    JPanel south = createPanel(0, hw, new JLabel("Search: "), search, names, zoom, colorize);
    search.setPreferredSize(new Dimension(100, -1));
    cp.add(south, BorderLayout.SOUTH);
    hw.addActionListener(this);
    names.addActionListener(this);
    zoom.addChangeListener(this);
    search.addKeyListener(this);
    colorize.addActionListener(this);
    setSize(800, 600);
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((screen.width - getWidth()) / 2, (screen.height - getHeight()) / 2);
    setVisible(animatorFrame == false);
    if (animatorFrame) names.setSelected(false);
  }
  WeightConverterGUI(ViewModel viewModel) {
    this.viewModel = viewModel;
    fromUnit.addItem("");
    toUnit.addItem("");
    backBind();

    actionButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            bind();
            WeightConverterGUI.this.viewModel.processKey();
            backBind();
          }
        });

    addCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            WeightConverterGUI.this.viewModel.setAddMode(addCheckBox.isSelected());
            backBind();
          }
        });
  }
  public void initialise() throws Exception {
    PreferencesLayoutPanel panel = new PreferencesLayoutPanel();
    setLayout(new BorderLayout());
    add(panel, BorderLayout.NORTH);

    OntologyPreferences prefs = OntologyPreferences.getInstance();

    panel.addGroup("Default ontology IRI base");
    panel.addGroupComponent(textField = new JTextField(prefs.getBaseURI().toString(), 40));
    panel.addGroupComponent(yearCheckBox = new JCheckBox("Include year", prefs.isIncludeYear()));
    panel.addGroupComponent(monthCheckBox = new JCheckBox("Include month", prefs.isIncludeMonth()));
    panel.addGroupComponent(dayCheckBox = new JCheckBox("Include day", prefs.isIncludeDay()));
    yearCheckBox.addActionListener(e -> updateState());
    monthCheckBox.addActionListener(e -> updateState());
    updateState();
  }
  /**
   * Checks state of the {@code checked} checkbox and if state is {@code checkedState} than to
   * disable {@code changed} text field and clean it. When the {@code checked} checkbox changes
   * states to other state, than enable {@code changed} and restore its state. Note that the each
   * text field should be implied by only one other checkbox.
   *
   * @param checked the checkbox to monitor
   * @param checkedState the state that triggers disabling changed state
   * @param changed the checkbox to change
   */
  public static void implyDisabled(
      final JCheckBox checked, final boolean checkedState, final JTextField changed) {
    ActionListener l =
        new ActionListener() {
          String previousState;

          public void actionPerformed(ActionEvent e) {
            if (checked.isSelected() == checkedState) {
              if (previousState == null) {
                previousState = changed.getText();
              }
              changed.setEnabled(false);
              changed.setText("");
            } else {
              changed.setEnabled(true);
              if (previousState != null) {
                changed.setText(previousState);
                previousState = null;
              }
            }
          }
        };
    checked.addActionListener(l);
    l.actionPerformed(null);
  }
 protected void buildAutomaticallyDisplayFormsForCreatedInstances(int yPosition) {
   _autoDisplayInstancesCheckbox =
       createCheckBox("Automatically display forms for created instances", yPosition);
   _autoDisplayInstancesCheckbox.setSelected(
       _scatterboxWidgetState.isAutomaticallyDisplayFormsForCreatedInstances());
   _autoDisplayInstancesCheckbox.addActionListener(new AutoDisplayCheckBoxListener());
 }
  /*-------------------------------------------------------------------------*/
  public FoeTypeSelection(int dirtyFlag) {
    this.dirtyFlag = dirtyFlag;
    List<String> foeTypesList =
        new ArrayList<String>(Database.getInstance().getFoeTypes().keySet());

    Collections.sort(foeTypesList);
    int max = foeTypesList.size();
    checkBoxes = new HashMap<String, JCheckBox>();

    JPanel panel = new JPanel(new GridLayout(max / 2 + 2, 2, 3, 3));

    selectAll = new JButton("Select All");
    selectAll.addActionListener(this);
    selectNone = new JButton("Select None");
    selectNone.addActionListener(this);

    panel.add(selectAll);
    panel.add(selectNone);

    for (String s : foeTypesList) {
      JCheckBox cb = new JCheckBox(s);
      checkBoxes.put(s, cb);
      cb.addActionListener(this);
      panel.add(cb);
    }

    JScrollPane scroller = new JScrollPane(panel);
    this.add(scroller);
  }
示例#10
0
  private MainPanel() {
    super(new GridLayout(3, 1, 5, 5));
    final JTree tree = new JTree();
    final JCheckBox c = new JCheckBox("CheckBox", true);
    c.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            tree.setEnabled(c.isSelected());
          }
        });
    c.setFocusPainted(false);
    JScrollPane l1 = new JScrollPane(tree);
    l1.setBorder(new ComponentTitledBorder(c, l1, BorderFactory.createEtchedBorder()));

    JLabel icon = new JLabel(new ImageIcon(getClass().getResource("16x16.png")));
    JLabel l2 = new JLabel("<html>aaaaaaaaaaaaaaaa<br>bbbbbbbbbbbbbbbbb");
    l2.setBorder(new ComponentTitledBorder(icon, l2, BorderFactory.createEtchedBorder()));

    JButton b = new JButton("Button");
    b.setFocusPainted(false);
    JLabel l3 = new JLabel("ccccccccccccccc");
    l3.setBorder(new ComponentTitledBorder(b, l3, BorderFactory.createEtchedBorder()));

    add(l1);
    add(l2);
    add(l3);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(320, 240));
  }
示例#11
0
  private Component createOptionsPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    onlyShowOutputOnErrorCheckBox = new JCheckBox("Only Show Output When Errors Occur");

    onlyShowOutputOnErrorCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            updateShowOutputOnErrorsSetting();
            settingsNode.setValueOfChildAsBoolean(
                SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected());
          }
        });

    // initialize its default value
    boolean valueAsBoolean =
        settingsNode.getValueOfChildAsBoolean(
            SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected());
    onlyShowOutputOnErrorCheckBox.setSelected(valueAsBoolean);

    updateShowOutputOnErrorsSetting();

    panel.add(Utility.addLeftJustifiedComponent(onlyShowOutputOnErrorCheckBox));

    return panel;
  }
示例#12
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);
  }
示例#13
0
  public void getPropertyComponents(List comps, final ObjectListener listener) {
    visibleCbx = new JCheckBox(getName(), visible);
    float[] rgb = color.get().getRGBComponents(null);
    slider = new JSlider(0, 100, (int) (rgb[0] * 100));

    float[] xyz = new float[3];
    direction.get(xyz);
    directionXFld = makeField("" + xyz[0], listener, "X Direction");
    directionYFld = makeField("" + xyz[1], listener, "Y Direction");
    directionZFld = makeField("" + xyz[2], listener, "Z Direction");

    double[] pxyz = new double[3];
    location.get(pxyz);
    locationXFld = makeField("" + pxyz[0], listener, "");
    locationYFld = makeField("" + pxyz[1], listener, "");
    locationZFld = makeField("" + pxyz[2], listener, "");

    List fldComps =
        Misc.newList(GuiUtils.rLabel("Direction:"), directionXFld, directionYFld, directionZFld);
    //
    // fldComps.addAll(Misc.newList(GuiUtils.rLabel("Location:"),locationXFld,locationYFld,locationZFld));

    comps.add(visibleCbx);
    GuiUtils.tmpInsets = new Insets(0, 2, 0, 0);
    comps.add(
        GuiUtils.vbox(
            slider, GuiUtils.left(GuiUtils.doLayout(fldComps, 4, GuiUtils.WT_N, GuiUtils.WT_N))));

    if (listener != null) {
      visibleCbx.addActionListener(listener);
      slider.addChangeListener(listener);
    }
  }
 void update(String group) {
   myTitleLabel.setText(
       "<html><body><h2 style=\"text-align:left;\">" + group + "</h2></body></html>");
   myContentPanel.removeAll();
   List<IdSet> idSets = PluginGroups.getInstance().getSets(group);
   for (final IdSet set : idSets) {
     final JCheckBox checkBox =
         new JCheckBox(set.getTitle(), PluginGroups.getInstance().isIdSetAllEnabled(set));
     checkBox.setModel(
         new JToggleButton.ToggleButtonModel() {
           @Override
           public boolean isSelected() {
             return PluginGroups.getInstance().isIdSetAllEnabled(set);
           }
         });
     checkBox.addActionListener(
         new ActionListener() {
           @Override
           public void actionPerformed(ActionEvent e) {
             PluginGroups.getInstance().setIdSetEnabled(set, !checkBox.isSelected());
             CustomizePluginsStepPanel.this.repaint();
           }
         });
     myContentPanel.add(checkBox);
   }
 }
  @Override
  public JComponent createCustomComponent(Presentation presentation) {
    // this component cannot be stored right here because of action system architecture:
    // one action can be shown on multiple toolbars simultaneously
    JCheckBox checkBox = new JCheckBox();
    checkBox.setOpaque(false);

    checkBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            JCheckBox checkBox = (JCheckBox) e.getSource();
            ActionToolbar actionToolbar = UIUtil.getParentOfType(ActionToolbar.class, checkBox);
            DataContext dataContext =
                actionToolbar != null
                    ? actionToolbar.getToolbarDataContext()
                    : DataManager.getInstance().getDataContext(checkBox);
            CheckboxAction.this.actionPerformed(
                new AnActionEvent(
                    null,
                    dataContext,
                    ActionPlaces.UNKNOWN,
                    CheckboxAction.this.getTemplatePresentation(),
                    ActionManager.getInstance(),
                    0));
          }
        });

    return checkBox;
  }
  /**
   * Checks state of the {@code checked} checkbox and if state is {@code checkedState} than to
   * disable {@code changed} checkbox and change its state to {@code impliedState}. When the {@code
   * checked} checkbox changes states to other state, than enable {@code changed} and restore its
   * state. Note that the each checkbox should be implied by only one other checkbox.
   *
   * @param checked the checkbox to monitor
   * @param checkedState the state that triggers disabling changed state
   * @param changed the checkbox to change
   * @param impliedState the implied state of checkbox
   */
  public static void imply(
      final JCheckBox checked,
      final boolean checkedState,
      final JCheckBox changed,
      final boolean impliedState) {
    ActionListener l =
        new ActionListener() {
          Boolean previousState;

          public void actionPerformed(ActionEvent e) {
            if (checked.isSelected() == checkedState) {
              if (previousState == null) {
                previousState = changed.isSelected();
              }
              changed.setEnabled(false);
              changed.setSelected(impliedState);
            } else {
              changed.setEnabled(true);
              if (previousState != null) {
                changed.setSelected(previousState);
                previousState = null;
              }
            }
          }
        };
    checked.addActionListener(l);
    l.actionPerformed(null);
  }
 /** 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();
 }
示例#18
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;
    }
 private JCheckBox getEnableMixerPanCheckBox() {
   if (enableMixerPanCheckBox == null) {
     enableMixerPanCheckBox = new JCheckBox("Pan");
     enableMixerPanCheckBox.setMnemonic('P');
     enableMixerPanCheckBox.addActionListener(eventHandler);
   }
   return enableMixerPanCheckBox;
 }
 public SuspiciousCollectionsMethodCallsInspection() {
   myReportConvertibleCalls.addActionListener(
       new ActionListener() {
         public void actionPerformed(final ActionEvent e) {
           REPORT_CONVERTIBLE_METHOD_CALLS = myReportConvertibleCalls.isSelected();
         }
       });
 }
 private JCheckBox getOptionsRenderingForceBulletColorCheckBox() {
   if (optionsRenderingForceBulletColorCheckBox == null) {
     optionsRenderingForceBulletColorCheckBox = new JCheckBox("Make all bullets white");
     optionsRenderingForceBulletColorCheckBox.setMnemonic('M');
     optionsRenderingForceBulletColorCheckBox.addActionListener(eventHandler);
   }
   return optionsRenderingForceBulletColorCheckBox;
 }
  public GoRunConfigurationEditorForm(final Project project) {

    applicationName
        .getButton()
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {

                TreeFileChooser fileChooser =
                    TreeFileChooserFactory.getInstance(project)
                        .createFileChooser(
                            "Go Application Chooser",
                            null,
                            GoFileType.INSTANCE,
                            new TreeFileChooser.PsiFileFilter() {
                              public boolean accept(PsiFile file) {

                                if (!(file instanceof GoFile)) {
                                  return false;
                                }

                                GoFile goFile = (GoFile) file;

                                return goFile.getPackage().isMainPackage();
                              }
                            },
                            true,
                            false);

                fileChooser.showDialog();

                PsiFile selectedFile = fileChooser.getSelectedFile();
                if (selectedFile != null) {
                  setChosenFile(selectedFile.getVirtualFile());
                }
              }
            });

    buildDirectoryPathBrowser.addBrowseFolderListener(
        "Go executable build path",
        "Go executable build path",
        project,
        new FileChooserDescriptor(false, true, false, false, false, false));

    workingDirectoryBrowser.addBrowseFolderListener(
        "Application working directory",
        "Application working directory",
        project,
        new FileChooserDescriptor(false, true, false, false, false, false));

    buildBeforeRunCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            buildDirectoryPathBrowser.setEnabled(buildBeforeRunCheckBox.isSelected());
          }
        });
  }
示例#23
0
  @Override
  protected JComponent createChangePanel() {
    final JComponent primaryPanel = new JPanel(new BorderLayout());
    JComponent propertyPanel = new JPanel(new BorderLayout());
    JComponent nameAndRandomizePanel = new JPanel(new BorderLayout());
    JComponent propertySetterPanel = createPropertyPanel();
    JComponent centerPanel = createCenterPanel();
    if (canRandomize) {
      shouldRandomizeCheckBox = new JCheckBox();
      shouldRandomizeCheckBox.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              shouldRandomize = shouldRandomizeCheckBox.isSelected();
            }
          });
      nameAndRandomizePanel.add(shouldRandomizeCheckBox, BorderLayout.LINE_START);
      final MouseListener unrandomizer =
          new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
              if (e.getComponent().contains(e.getPoint())
                  && !shouldRandomizeCheckBox.contains(e.getPoint())) {
                shouldRandomizeCheckBox.setSelected(false);
                shouldRandomize = false;
              } else {
                System.out.println(e.getPoint() + "Is out of bounds");
              }
            }
          };
      ContainerListener mouseListenerAdder =
          new ContainerAdapter() {
            @Override
            public void componentAdded(ContainerEvent e) {
              addListeners(e.getChild());
            }

            public void addListeners(Component c) {
              c.addMouseListener(unrandomizer);
              if (c instanceof Container) {
                ((Container) c).addContainerListener(this);
                for (Component child : ((Container) c).getComponents()) {
                  addListeners(child);
                }
              }
            }
          };
      primaryPanel.addMouseListener(unrandomizer);
      primaryPanel.addContainerListener(mouseListenerAdder);
    }
    if (centerPanel != null) primaryPanel.add(centerPanel, BorderLayout.CENTER);
    nameAndRandomizePanel.add(new JLabel(name), BorderLayout.CENTER);
    propertyPanel.add(nameAndRandomizePanel, BorderLayout.LINE_START);
    propertyPanel.add(propertySetterPanel, BorderLayout.LINE_END);
    primaryPanel.add(propertyPanel, BorderLayout.PAGE_START);
    return primaryPanel;
  }
示例#24
0
 public JCheckBox getWholeWordCheckBox() {
   if (wholeWordCheckBox == null) {
     wholeWordCheckBox = new JCheckBox();
     wholeWordCheckBox.setText("Whole Words Only");
     wholeWordCheckBox.setMnemonic('W');
     wholeWordCheckBox.addActionListener(this);
   }
   return wholeWordCheckBox;
 }
 private JCheckBox getOptionsRenderingBufferImagesCheckBox() {
   if (optionsRenderingBufferImagesCheckBox == null) {
     optionsRenderingBufferImagesCheckBox = new JCheckBox("Buffer images (uses memory)");
     optionsRenderingBufferImagesCheckBox.setMnemonic('i');
     optionsRenderingBufferImagesCheckBox.setDisplayedMnemonicIndex(7);
     optionsRenderingBufferImagesCheckBox.addActionListener(eventHandler);
   }
   return optionsRenderingBufferImagesCheckBox;
 }
示例#26
0
  public ApkStep(ExportSignedPackageWizard wizard) {
    myWizard = wizard;
    myApkPathLabel.setLabelFor(myApkPathField);
    myProguardConfigFilePathLabel.setLabelFor(myProguardConfigFilePathField);

    myApkPathField
        .getButton()
        .addActionListener(
            new SaveFileListener(
                myContentPanel,
                myApkPathField,
                AndroidBundle.message("android.extract.package.choose.dest.apk")) {
              @Override
              protected String getDefaultLocation() {
                Module module = myWizard.getFacet().getModule();
                return getContentRootPath(module);
              }
            });

    myProguardConfigFilePathField
        .getButton()
        .addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                final String path = myProguardConfigFilePathField.getText().trim();
                VirtualFile defaultFile =
                    path != null && path.length() > 0
                        ? LocalFileSystem.getInstance().findFileByPath(path)
                        : null;
                final AndroidFacet facet = myWizard.getFacet();

                if (defaultFile == null && facet != null) {
                  defaultFile = AndroidRootUtil.getMainContentRoot(facet);
                }
                final VirtualFile file =
                    FileChooser.chooseFile(
                        myContentPanel,
                        FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(),
                        defaultFile);
                if (file != null) {
                  myProguardConfigFilePathField.setText(
                      FileUtil.toSystemDependentName(file.getPath()));
                }
              }
            });

    myProguardCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            final boolean enabled = myProguardCheckBox.isSelected();
            myProguardConfigFilePathLabel.setEnabled(enabled);
            myProguardConfigFilePathField.setEnabled(enabled);
          }
        });
  }
  public Dart2JSSettingsDialog(@Nullable Project project, String jsFilePath) {
    super(project, true);
    myOutputFilePath.setText(FileUtil.toSystemDependentName(jsFilePath));

    myCheckedMode.setSelected(
        PropertiesComponent.getInstance().getBoolean("dart2js.checked.mode", false));
    myMinify.setSelected(PropertiesComponent.getInstance().getBoolean("dart2js.minify", false));

    myCheckedMode.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            PropertiesComponent.getInstance()
                .setValue("dart2js.checked.mode", Boolean.toString(myCheckedMode.isSelected()));
          }
        });
    myMinify.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            PropertiesComponent.getInstance()
                .setValue("dart2js.minify", Boolean.toString(myMinify.isSelected()));
          }
        });
    myOutputFilePath
        .getButton()
        .addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                final FileChooserDescriptor descriptor =
                    new FileChooserDescriptor(false, true, false, false, false, false);
                final VirtualFile file =
                    FileChooser.chooseFile(descriptor, myMainPanel, null, null);
                if (file != null) {
                  myOutputFilePath.setText(FileUtil.toSystemDependentName(file.getPath()));
                }
              }
            });

    setTitle("Dart2JS");
    init();
  }
示例#28
0
 public JCheckBox getCaseSensitiveCheckBox() {
   if (caseSensitiveCheckBox == null) {
     caseSensitiveCheckBox = new JCheckBox();
     caseSensitiveCheckBox.setText("Case Sensitive");
     caseSensitiveCheckBox.setMnemonic('v');
     caseSensitiveCheckBox.setDisplayedMnemonicIndex(12);
     caseSensitiveCheckBox.addActionListener(this);
   }
   return caseSensitiveCheckBox;
 }
 private void initScopeFilter() {
   myUseScopeFilteringCb.setSelected(false);
   myScopeCombo.setEnabled(false);
   myUseScopeFilteringCb.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           myScopeCombo.setEnabled(myUseScopeFilteringCb.isSelected());
         }
       });
 }
 public MyComponent() {
   myOverrideLAFFonts.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           updateCombo();
         }
       });
   if (!Registry.is("ide.transparency.mode.for.windows")) {
     myTransparencyPanel.getParent().remove(myTransparencyPanel);
   }
 }