@Override public JComponent createComponent() { if (myMainComponent == null) { myMainComponent = new JPanel(new BorderLayout()); myCbUseSoftWrapsAtConsole = new JCheckBox(ApplicationBundle.message("checkbox.use.soft.wraps.at.console"), false); myCommandsHistoryLimitField = new JTextField(3); myCbOverrideConsoleCycleBufferSize = new JCheckBox( ApplicationBundle.message( "checkbox.override.console.cycle.buffer.size", String.valueOf(ConsoleBuffer.getLegacyCycleBufferSize() / 1024)), false); myCbOverrideConsoleCycleBufferSize.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { myConsoleCycleBufferSizeField.setEnabled( myCbOverrideConsoleCycleBufferSize.isSelected()); } }); myConsoleCycleBufferSizeField = new JTextField(3); JPanel northPanel = new JPanel(new GridBagLayout()); GridBag gridBag = new GridBag(); gridBag.anchor(GridBagConstraints.WEST).setDefaultAnchor(GridBagConstraints.WEST); northPanel.add(myCbUseSoftWrapsAtConsole, gridBag.nextLine().next()); northPanel.add(Box.createHorizontalGlue(), gridBag.next().coverLine()); northPanel.add( new JLabel(ApplicationBundle.message("editbox.console.history.limit")), gridBag.nextLine().next()); northPanel.add(myCommandsHistoryLimitField, gridBag.next()); if (ConsoleBuffer.useCycleBuffer()) { northPanel.add(myCbOverrideConsoleCycleBufferSize, gridBag.nextLine().next()); northPanel.add(myConsoleCycleBufferSizeField, gridBag.next()); } if (!editFoldingsOnly()) { JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(northPanel, BorderLayout.WEST); myMainComponent.add(wrapper, BorderLayout.NORTH); } Splitter splitter = new Splitter(true); myMainComponent.add(splitter, BorderLayout.CENTER); myPositivePanel = new MyAddDeleteListPanel( "Fold console lines that contain", "Enter a substring of a console line you'd like to see folded:"); myNegativePanel = new MyAddDeleteListPanel( "Exceptions", "Enter a substring of a console line you don't want to fold:"); splitter.setFirstComponent(myPositivePanel); splitter.setSecondComponent(myNegativePanel); myPositivePanel.getEmptyText().setText("Fold nothing"); myNegativePanel.getEmptyText().setText("No exceptions"); } return myMainComponent; }
private void addChangeListeners() { ChangeListener translationChangeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { _dotDefinitionDialogFrame.setSomethingChanged(true); } }; _translationFactorSpinner.addChangeListener(translationChangeListener); ChangeListener joinByLineChangeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { _dotDefinitionDialogFrame.setSomethingChanged(true); } }; _joinByLineCheckBox.addChangeListener(joinByLineChangeListener); }
/** * Utility method to add components to dialog list * * @param comps list to add to * @param name name * @param cbx enable checkbox * @param comp the component */ private void addEditComponents( List comps, String name, final JCheckBox cbx, final JComponent comp) { cbx.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { GuiUtils.enableTree(comp, cbx.isSelected()); } }); GuiUtils.enableTree(comp, cbx.isSelected()); comps.add(GuiUtils.top(GuiUtils.inset(cbx, 5))); comps.add(GuiUtils.top(GuiUtils.inset(GuiUtils.rLabel(name), new Insets(8, 0, 0, 0)))); JComponent right = GuiUtils.inset(comp, new Insets(3, 5, 0, 0)); // comps.add(GuiUtils.leftCenter(GuiUtils.top(GuiUtils.inset(cbx, // new Insets(2, 0, 0, 0))), GuiUtils.topLeft(right))); comps.add(GuiUtils.topLeft(right)); }
private JComponent createSouthPanel() { final JCheckBox checkBox = new JCheckBox(IdeBundle.message("checkbox.narrow.down.on.typing")); checkBox.setSelected(PropertiesComponent.getInstance().getBoolean(narrowDownPropertyKey, true)); checkBox.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { myShouldNarrowDown = checkBox.isSelected(); PropertiesComponent.getInstance() .setValue(narrowDownPropertyKey, Boolean.toString(myShouldNarrowDown)); if (mySpeedSearch.isPopupActive() && !StringUtil.isEmpty(mySpeedSearch.getEnteredPrefix())) { myAbstractTreeBuilder.queueUpdate(); } } }); checkBox.setFocusable(false); UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, checkBox); final JPanel panel = new JPanel(new BorderLayout()); panel.add(checkBox, BorderLayout.WEST); return panel; }
protected JPanel createOptionPanel() { JPanel oP = new JPanel(); oP.setLayout(new BoxLayout(oP, BoxLayout.Y_AXIS)); preservePermBox.setEnabled(false); preservePermBox.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { boolean selected = preservePermBox.isSelected(); boolean enableTargetPerm = !selected; permBox.setEnabled(enableTargetPerm); permButton.setEnabled(enableTargetPerm); } }); permButton.setActionCommand("permissions"); permButton.addActionListener(this); JPanel permPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); permPanel.add(permBox); permPanel.add(permButton); permBox.setEnabled(false); permButton.setEnabled(false); followSymLinkBox.setAlignmentX(Component.LEFT_ALIGNMENT); preserveMtimeBox.setAlignmentX(Component.LEFT_ALIGNMENT); preservePermBox.setAlignmentX(Component.LEFT_ALIGNMENT); permPanel.setAlignmentX(Component.LEFT_ALIGNMENT); oP.add(followSymLinkBox); oP.add(preserveMtimeBox); oP.add(preservePermBox); oP.add(permPanel); return oP; }
public ScalaApplicationSettingsForm(ScalaApplicationSettings settings) { mySettings = settings; myEnableCompileServer.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { updateCompilationServerSettingsPanel(); } }); initCompilerTypeCmb(); initCompileOrderCmb(); ProjectSdksModel model = new ProjectSdksModel(); model.reset(null); myCompilationServerSdk = new JdkComboBox(model); myCompilationServerSdk.insertItemAt(new JdkComboBox.NoneJdkComboBoxItem(), 0); mySdkPanel.add(myCompilationServerSdk, BorderLayout.CENTER); mySdkPanel.setSize(mySdkPanel.getPreferredSize()); myNote.setForeground(JBColor.GRAY); delaySpinner.setEnabled(showTypeInfoOnCheckBox.isSelected()); showTypeInfoOnCheckBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { delaySpinner.setEnabled(showTypeInfoOnCheckBox.isSelected()); } }); delaySpinner.setValue(mySettings.SHOW_TYPE_TOOLTIP_DELAY); updateCompilationServerSettingsPanel(); }
public BiblioSearchLimitPanel( DatabankSchema schema, MarcQueryBuilder queryBuilder, int language, SearchUI utils) { super(new GridBagLayout(), queryBuilder); this.schema = schema; this.language = language; ButtonGroup g; props = PropertyUtils.loadProperties(getClass().getName(), LocaleUtils.getLocale(language)); GuiUtils.setActionName(dateRangeAction, props.getProperty("date_range.name")); GuiUtils.setActionName(yearAction, props.getProperty("year.name")); this.utils = utils; lblCodingLevel = new JLabel(props.getProperty("coding_level.name")); cmCodingLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_17); cmCodingLevel.setName("biblioCodingLevel"); lblCodingLevel.setLabelFor(cmCodingLevel); lblCataloguingForm = new JLabel(props.getProperty("cataloguing_form.name")); cmCataloguingForm = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_18); cmCataloguingForm.setName("biblioCataloguingForm"); lblCataloguingForm.setLabelFor(cmCataloguingForm); rBetween = new JRadioButton(props.getProperty("between.name")); rBetween.setName("biblioBetweenYears"); rLt = new JRadioButton(props.getProperty("lt.name")); rLt.setName("biblioLessThanYear"); rGt = new JRadioButton(props.getProperty("gt.name")); rGt.setName("biblioGreaterThanYear"); txfYear = utils.queryTextField(4); txfYear.setName("biblioYearEquals"); rYear = new JRadioButton(yearAction); rYear.setName("biblioYear"); rDateRange = new JRadioButton(dateRangeAction); rDateRange.setName("biblioDateRange"); lblDoctype = new JLabel(props.getProperty("biblio_doctype.name")); lblFrom = new JLabel(props.getProperty("from.name")); lblTo = new JLabel(props.getProperty("to.name")); lblLanguage = new JLabel(props.getProperty("language.name")); lblLocation = new JLabel(props.getProperty("location.name")); lblRetriveNo = new JLabel(props.getProperty("retriveNo.name")); lblRecType = new JLabel(props.getProperty("rectype.name")); lblRecStatus = new JLabel(props.getProperty("recstatus.name")); lblCalendar = new JLabel(props.getProperty("calendar.name")); lblBiblevel = new JLabel(props.getProperty("biblevel.name")); lblHierarchicalLevel = new JLabel(props.getProperty("hierarchical_level.name")); cmDoctype = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_DOC_TYPE); cmDoctype.setName("biblioDocType"); cmLocation = utils.constantTableLookup(SearchEngineDocumentModel.LOCATION); cmLocation.setName("biblioLocation"); cmLanguage = utils.constantTableLookup(SearchEngineDocumentModel.LANGUAGE); cmLanguage.setName("biblioLanguage"); cmBiblevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_7); cmBiblevel.setName("biblioLevel"); cmHierarchicalLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_8); cmHierarchicalLevel.setName("biblioHierarchicalLevel"); cmRecType = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_6); cmRecType.setName("biblioRecType"); cmRecStatus = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_5); cmRecStatus.setName("biblioRecStatus"); cmCalendar = utils.constantTableLookup(SearchEngineDocumentModel.CALENDAR); cmCalendar.setName("biblioCalendar"); txfFrom = utils.queryTextField(10); txfFrom.setName("biblioFromYear"); txfTo = utils.queryTextField(10); txfTo.setName("biblioToYear"); txfRetriveNo = utils.queryTextField(10); txfRetriveNo.setName("retriveNo"); lblDoctype.setLabelFor(cmDoctype); lblLocation.setLabelFor(cmLocation); lblLanguage.setLabelFor(cmLanguage); lblFrom.setLabelFor(txfFrom); lblTo.setLabelFor(txfTo); lblRetriveNo.setLabelFor(txfRetriveNo); lblTo.setVerticalTextPosition(JLabel.BOTTOM); lblCalendar.setHorizontalAlignment(JLabel.TRAILING); lblLanguage.setHorizontalAlignment(JLabel.TRAILING); lblRecType.setHorizontalAlignment(JLabel.TRAILING); lblDoctype.setHorizontalAlignment(JLabel.TRAILING); lblLocation.setHorizontalAlignment(JLabel.TRAILING); cbHasAttachment = new JCheckBox(props.getProperty("attachment.name")); cbIsOpenShelf = new JCheckBox(props.getProperty("openShelf.name")); cbIsLendable = new JCheckBox(props.getProperty("lendable.name")); rWithAttachment = new JRadioButton(props.getProperty("attachment-present.name")); rWithoutAttachment = new JRadioButton(props.getProperty("attachment-notpresent.name")); cbHasAttachment.setName("biblioAttachment"); cbIsOpenShelf.setName("holdingIsOpenShelf"); cbIsLendable.setName("holdingIsLendable"); rWithAttachment.setName("biblioAttachmentPresent"); rWithoutAttachment.setName("biblioAttachmentNotPresent"); cbHasAttachment.addChangeListener(attachmentChangedListener); rWithAttachment.setEnabled(false); rWithoutAttachment.setEnabled(false); cbHasAttachment.setSelected(false); cbIsOpenShelf.setSelected(false); cbIsLendable.setSelected(false); g = new ButtonGroup(); g.add(rWithAttachment); g.add(rWithoutAttachment); g = new ButtonGroup(); g.add(rBetween); g.add(rLt); g.add(rGt); g = new ButtonGroup(); g.add(rDateRange); g.add(rYear); rYear.setSelected(true); dateCriteriaChanged(); lblDescriptionLevel = new JLabel(props.getProperty("level-of-description.name")); cmDescriptionLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_ISAD_LEVEL_OF_DESCRIPTION); cmDescriptionLevel.setName("biblioDescriptionLevel"); lblDescriptionLevel.setLabelFor(cmDescriptionLevel); lblGMD = new JLabel(props.getProperty("general-material.name")); cmGMD = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_GMD_LIST); cmGMD.setName("biblioGMD"); lblGMD.setLabelFor(cmGMD); lblLCClass = new JLabel(props.getProperty("lcclass.name")); txfLCClass = new JTextField(20); GuiUtils.localeSupport(txfLCClass); GuiUtils.setComponentOrientation(txfLCClass, ComponentOrientation.LEFT_TO_RIGHT); lblLCClass.setLabelFor(txfLCClass); LayoutFacility lf = new LayoutFacility(this); /* lf.add(lblCodingLevel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add(cmCodingLevel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); */ int y = 0; lf.add( lblDoctype, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmDoctype, new GridBagConstraints( 1, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblRecType, new GridBagConstraints( 2, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmRecType, new GridBagConstraints( 3, y++, GridBagConstraints.REMAINDER, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblGMD, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmGMD, new GridBagConstraints( 1, y++, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblLocation, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmLocation, new GridBagConstraints( 1, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblLanguage, new GridBagConstraints( 2, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmLanguage, new GridBagConstraints( 3, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblBiblevel, new GridBagConstraints( 4, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmBiblevel, new GridBagConstraints( 5, y++, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); //// lf.add( lblCataloguingForm, new GridBagConstraints( 0, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmCataloguingForm, new GridBagConstraints( 1, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblHierarchicalLevel, new GridBagConstraints( 2, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmHierarchicalLevel, new GridBagConstraints( 3, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblRecStatus, new GridBagConstraints( 4, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmRecStatus, new GridBagConstraints( 5, y++, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); //// lf.add( lblCodingLevel, new GridBagConstraints( 4, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmCodingLevel, new GridBagConstraints( 5, y, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); lf.add( rYear, new GridBagConstraints( 0, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); lf.add( txfYear, new GridBagConstraints( 1, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lblCalendar, new GridBagConstraints( 2, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( cmCalendar, new GridBagConstraints( 3, y++, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( rDateRange, new GridBagConstraints( 0, y, 1, 1, 1.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); LayoutFacility datelf = new LayoutFacility(new JPanel()); datelf.add( lblFrom, new GridBagConstraints( 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); datelf.add( txfFrom, new GridBagConstraints( 2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( rGt, new GridBagConstraints( 3, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( rBetween, new GridBagConstraints( 4, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( rLt, new GridBagConstraints( 5, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( lblTo, new GridBagConstraints( 6, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); datelf.add( txfTo, new GridBagConstraints( 7, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); datelf.add( Box.createHorizontalGlue(), new GridBagConstraints( 8, 1, GridBagConstraints.REMAINDER, 1, 1.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( datelf.container, new GridBagConstraints( 1, y++, GridBagConstraints.REMAINDER, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); LayoutFacility lcClasslf = new LayoutFacility(new JPanel()); lcClasslf.add( lblLCClass, new GridBagConstraints( 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); lcClasslf.add( txfLCClass, new GridBagConstraints( 2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); lf.add( lcClasslf.container, new GridBagConstraints( 0, y++, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); LayoutFacility attLf = LayoutFacility.createLayoutFacility(); int x = 0; attLf.add( cbHasAttachment, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); attLf.add( cbIsOpenShelf, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); // attLf.add(cbIsLendable, // new GridBagConstraints(x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, // GridBagConstraints.NONE, new Insets(2, 2, 2, 10), 0, 0)); attLf.add( lblRetriveNo, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 20, 2, 2), 0, 0)); attLf.add( txfRetriveNo, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 25, 0)); if (SystemUtils.isISADAvailable()) { attLf.add( lblDescriptionLevel, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 20, 2, 2), 0, 0)); attLf.add( cmDescriptionLevel, new GridBagConstraints( x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); } /* attLf.add(rWithAttachment, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); attLf.add(rWithoutAttachment, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); */ lf.add( attLf.container, new GridBagConstraints( 0, y, GridBagConstraints.REMAINDER, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); // lf.add(Box.createHorizontalGlue(), // new GridBagConstraints(1, 4, 0, 1, 0.0, 0.0, GridBagConstraints.LINE_START, // GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); ChangeListener limitChangeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { txfFrom.setEditable(!rLt.isSelected() && rDateRange.isSelected()); txfTo.setEditable(!rGt.isSelected() && rDateRange.isSelected()); } }; rGt.addChangeListener(limitChangeListener); rLt.addChangeListener(limitChangeListener); rBetween.addChangeListener(limitChangeListener); rGt.setSelected(true); }
public MCMCPanel(BeautiFrame parent) { setLayout(new BorderLayout()); // Mac OS X components have more spacing round them already optionsPanel = new OptionsPanel(12, (OSType.isMac() ? 6 : 24)); this.frame = parent; setOpaque(false); optionsPanel.setOpaque(false); chainLengthField.setValue(100000); chainLengthField.setColumns(10); optionsPanel.addComponentWithLabel("Length of chain:", chainLengthField); chainLengthField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.chainLength = chainLengthField.getValue(); frame.setDirty(); } }); optionsPanel.addSeparator(); echoEveryField.setValue(1000); echoEveryField.setColumns(10); optionsPanel.addComponentWithLabel("Echo state to screen every:", echoEveryField); echoEveryField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.echoEvery = echoEveryField.getValue(); frame.setDirty(); } }); logEveryField.setValue(100); logEveryField.setColumns(10); optionsPanel.addComponentWithLabel("Log parameters every:", logEveryField); logEveryField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.logEvery = logEveryField.getValue(); frame.setDirty(); } }); optionsPanel.addSeparator(); fileNameStemField.setColumns(32); optionsPanel.addComponentWithLabel("File name stem:", fileNameStemField); fileNameStemField.setEditable(true); fileNameStemField.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { options.fileNameStem = fileNameStemField.getText(); updateOtherFileNames(options); frame.setDirty(); } }); optionsPanel.addComponent(addTxt); if (OSType.isWindows()) { addTxt.setSelected(true); } else { addTxt.setSelected(false); } addTxt.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { setOptions(options); frame.setDirty(); } }); optionsPanel.addSeparator(); logFileNameField.setColumns(32); optionsPanel.addComponentWithLabel("Log file name:", logFileNameField); logFileNameField.setEditable(false); // optionsPanel.addComponent(allowOverwriteLogCheck); // allowOverwriteLogCheck.setSelected(false); // allowOverwriteLogCheck.addChangeListener(new ChangeListener() { // public void stateChanged(ChangeEvent changeEvent) { // options.allowOverwriteLog = allowOverwriteLogCheck.isSelected(); // } // }); treeFileNameField.setColumns(32); optionsPanel.addComponentWithLabel("Trees file name:", treeFileNameField); treeFileNameField.setEditable(false); // addComponent(mapTreeLogCheck); // mapTreeLogCheck.setOpaque(false); // mapTreeLogCheck.addActionListener(new java.awt.event.ActionListener() { // public void actionPerformed(ActionEvent e) { // mapTreeFileNameField.setEnabled(mapTreeLogCheck.isSelected()); // } // }); // // mapTreeFileNameField.setColumns(32); // addComponentWithLabel("MAP tree file name:", mapTreeFileNameField); optionsPanel.addComponent(substTreeLogCheck); substTreeLogCheck.setOpaque(false); substTreeLogCheck.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { options.substTreeLog = substTreeLogCheck.isSelected(); updateTreeFileNameList(); substTreeFileNameField.setEnabled(substTreeLogCheck.isSelected()); if (substTreeLogCheck.isSelected()) { substTreeFileNameField.setText(displayTreeList(options.substTreeFileName)); } else { substTreeFileNameField.setText(""); } frame.setDirty(); } }); substTreeFileNameField.setColumns(32); substTreeFileNameField.setEditable(false); substTreeFileNameField.setEnabled(false); optionsPanel.addComponentWithLabel("Substitutions trees file name:", substTreeFileNameField); optionsPanel.addComponent(operatorAnalaysisCheck); operatorAnalaysisCheck.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { options.operatorAnalysis = operatorAnalaysisCheck.isSelected(); updateOtherFileNames(options); frame.setDirty(); } }); operatorAnalaysisFileNameField.setColumns(32); operatorAnalaysisFileNameField.setEditable(false); operatorAnalaysisFileNameField.setEnabled(false); optionsPanel.addComponentWithLabel( "Operator analysis file name:", operatorAnalaysisFileNameField); optionsPanel.addSeparator(); optionsPanel.addComponent(samplePriorCheckBox); samplePriorCheckBox.setOpaque(false); samplePriorCheckBox.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { frame.setDirty(); } }); // logFileNameField.addKeyListener(listener); // treeFileNameField.addKeyListener(listener); // mapTreeFileNameField.addKeyListener(listener); // substTreeFileNameField.addKeyListener(listener); // optionsPanel.setPreferredSize(new java.awt.Dimension(500, 600)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); panel.add(optionsPanel, BorderLayout.CENTER); panel.setOpaque(false); JScrollPane scrollPane = new JScrollPane( panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setOpaque(false); scrollPane.setBorder(null); scrollPane.getViewport().setOpaque(false); add(scrollPane, BorderLayout.CENTER); }
public Component getCustomOptionComponent() { /* DEPTH */ final JSpinner jspnMaxDepth = new JSpinner(new SpinnerNumberModel(s_maxDepth + 1, 1, 100, 1)); jspnMaxDepth.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { Integer value = (Integer) ((JSpinner) e.getSource()).getValue(); s_maxDepth = value - 1; logger.debug("maxDepth " + (s_maxDepth + 1)); } }); final JRadioButton jrbMaxDepth = new JRadioButton("Depth"); final JLabel lblMaxDepth = new JLabel("Depth: "); final JPanel jpMaxDepthSub = new JPanel() { @Override public void setEnabled(boolean b) { super.setEnabled(b); jspnMaxDepth.setEnabled(b); lblMaxDepth.setEnabled(b); } }; jpMaxDepthSub.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); jpMaxDepthSub.add(lblMaxDepth); jpMaxDepthSub.add(jspnMaxDepth); /// final JPanel jpMaxDepth = new JPanel() { @Override public void setEnabled(boolean b) { super.setEnabled(b); jrbMaxDepth.setEnabled(b); jpMaxDepthSub.setEnabled(b); } }; jpMaxDepth.setLayout(new BoxLayout(jpMaxDepth, BoxLayout.Y_AXIS)); jpMaxDepth.add(GuiUtil.addComponentAsFlow(jrbMaxDepth, FlowLayout.LEFT)); jpMaxDepth.add(GuiUtil.addComponentAsFlow(jpMaxDepthSub, FlowLayout.RIGHT)); /* REPETITION */ final JSpinner jspnMaxRept = new JSpinner(new SpinnerNumberModel(s_maxRept, 1, 100, 1)); jspnMaxRept.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { s_maxRept = (Integer) ((JSpinner) e.getSource()).getValue(); logger.debug("maxRept " + s_maxRept); } }); final JRadioButton jrbMaxRept = new JRadioButton("Repetition"); final JLabel lblMaxRept = new JLabel("Count: "); final JPanel jpMaxReptSub = new JPanel() { @Override public void setEnabled(boolean b) { super.setEnabled(b); jspnMaxRept.setEnabled(b); lblMaxRept.setEnabled(b); } }; jpMaxReptSub.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); jpMaxReptSub.add(lblMaxRept); jpMaxReptSub.add(jspnMaxRept); final JPanel jpMaxRept = new JPanel() { @Override public void setEnabled(boolean b) { super.setEnabled(b); jrbMaxRept.setEnabled(b); jpMaxReptSub.setEnabled(b); } }; jpMaxRept.setLayout(new BoxLayout(jpMaxRept, BoxLayout.Y_AXIS)); jpMaxRept.add(GuiUtil.addComponentAsFlow(jrbMaxRept, FlowLayout.LEFT)); jpMaxRept.add(GuiUtil.addComponentAsFlow(jpMaxReptSub, FlowLayout.RIGHT)); /////////////////////////////////////// final JLabel lbl = new JLabel("Limit search by:", SwingConstants.LEFT); final JPanel panel = new JPanel() { @Override public void setEnabled(boolean b) { super.setEnabled(b); lbl.setEnabled(b); jpMaxDepth.setEnabled(b); jpMaxRept.setEnabled(b); } @Override public void setVisible(boolean b) { super.setVisible(b); final JPanel p = this; // SwingUtilities.invokeLater( new Runnable() { // public void run() { Window win = SwingUtilities.getWindowAncestor(p); System.err.println(win); if (win != null) { System.err.println("packing"); win.pack(); } // } // } ); } }; panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); panel.add(GuiUtil.addComponentAsFlow(lbl, FlowLayout.LEFT)); panel.add(jpMaxDepth); panel.add(jpMaxRept); ButtonGroup bg = new ButtonGroup(); bg.add(jrbMaxDepth); bg.add(jrbMaxRept); /* CHECKBOX */ final JCheckBox chboxRepeat = new JCheckBox("Allow subtask recursive repetition", s_isSubtaskRepetitionAllowed); chboxRepeat.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { if (s_isSubtaskRepetitionAllowed == chboxRepeat.isSelected()) return; s_isSubtaskRepetitionAllowed = chboxRepeat.isSelected(); panel.setVisible(s_isSubtaskRepetitionAllowed); logger.debug("m_isSubtaskRepetitionAllowed " + s_isSubtaskRepetitionAllowed); } }); panel.setVisible(s_isSubtaskRepetitionAllowed); final JCheckBox chboxIncremental = new JCheckBox("Incremental", s_isIncremental); chboxIncremental.setToolTipText("Incremental depth-first search"); chboxIncremental.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { if (s_isIncremental == chboxIncremental.isSelected()) return; s_isIncremental = chboxIncremental.isSelected(); logger.debug("isIncremental " + s_isIncremental); } }); final JCheckBox chboxOptimize = new JCheckBox("Disable optimization in subtasks", s_disableOptimizationInSubtasks); chboxOptimize.setToolTipText("Use for debugging purposes"); chboxOptimize.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { if (s_disableOptimizationInSubtasks == chboxOptimize.isSelected()) return; s_disableOptimizationInSubtasks = chboxOptimize.isSelected(); logger.debug("disableOptimizationInSubtasks " + s_disableOptimizationInSubtasks); } }); JPanel container1 = new JPanel(); container1.setLayout(new BoxLayout(container1, BoxLayout.Y_AXIS)); container1.setBorder(BorderFactory.createTitledBorder("Planning settings")); container1.add(GuiUtil.addComponentAsFlow(chboxOptimize, FlowLayout.LEFT)); container1.add(GuiUtil.addComponentAsFlow(chboxIncremental, FlowLayout.LEFT)); container1.add(GuiUtil.addComponentAsFlow(chboxRepeat, FlowLayout.LEFT)); container1.add(GuiUtil.addComponentAsFlow(panel, FlowLayout.LEFT)); JPanel container2 = new JPanel(new GridLayout(2, 0)); container2.setBorder(BorderFactory.createTitledBorder("Logging options")); final JCheckBox linear = new JCheckBox("Detailed linear planning", isLinearLoggingOn()); linear.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { setLinearLoggingOn(linear.isSelected()); } }); container2.add(linear); final JCheckBox subtask = new JCheckBox("Detailed subtask planning", isSubtaskLoggingOn()); subtask.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { setSubtaskLoggingOn(subtask.isSelected()); } }); container2.add(subtask); JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); main.add(container1); main.add(container2); return main; }
/** Generates Configuration tab. */ private void fillConfigurationPanel() { JPanel desc = new JPanel(new GridLayout(2, 0)); desc.setBorder(BorderFactory.createTitledBorder("Description")); desc.add( new JLabel("<html><font color=\"blue\">" + myMonitor.getDescription() + "</font></html>")); desc.add(cbEnabled); cbEnabled.setSelected(enabled); cbEnabled.addChangeListener(this); confPanel.add(desc); JPanel mlpanel = new JPanel(new GridLayout(1, 0)); mlpanel.setBorder(BorderFactory.createTitledBorder("Monitored Network Elements")); montable = new JTable(montablemodel); montable.setPreferredScrollableViewportSize(new Dimension(200, 100)); montable.getColumnModel().getColumn(0).setPreferredWidth(140); montable.getColumnModel().getColumn(1).setPreferredWidth(60); montable.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int row = montable.rowAtPoint(new Point(e.getX(), e.getY())); AbstractNetworkElement ne = null; if ((row >= 0) && (row < myMonitor.getPredecessors().size())) ne = myMonitor.getPredecessors().get(row); else return; treePane.actionSelected(ne, true); } return; } }); mlpanel.add(new JScrollPane(montable)); confPanel.add(mlpanel); JPanel cpanel = new JPanel(new GridLayout(1, 0)); cpanel.setBorder(BorderFactory.createTitledBorder("Controlleded Network Elements")); ctrltable = new JTable(ctrltablemodel); ctrltable.setPreferredScrollableViewportSize(new Dimension(200, 100)); ctrltable.getColumnModel().getColumn(0).setPreferredWidth(140); ctrltable.getColumnModel().getColumn(1).setPreferredWidth(60); ctrltable.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int row = ctrltable.rowAtPoint(new Point(e.getX(), e.getY())); AbstractNetworkElement ne = null; if ((row >= 0) && (row < myMonitor.getSuccessors().size())) ne = myMonitor.getSuccessors().get(row); else return; treePane.actionSelected(ne, true); } return; } }); cpanel.add(new JScrollPane(ctrltable)); confPanel.add(cpanel); JPanel pcl = new JPanel(new FlowLayout()); // controller list buttonProp.setEnabled(false); buttonProp.setActionCommand(cmdCtrlProp); buttonProp.addActionListener(this); pcl.setBorder(BorderFactory.createTitledBorder("Complex Controller")); buttonProp.setEnabled(false); listCControllers = new JComboBox(); listCControllers.addItem("None"); String[] ctrlClasses = myMonitor.getComplexControllerClasses(); for (int i = 0; i < ctrlClasses.length; i++) { if ((myController != null) && (myController.getClass().getName().compareTo(ctrlClasses[i]) == 0)) { listCControllers.addItem(myController); listCControllers.setSelectedIndex(i + 1); buttonProp.setEnabled(true); } else { try { Class cl = Class.forName(ctrlClasses[i]); AbstractControllerComplex cc = (AbstractControllerComplex) cl.newInstance(); cc.setMyMonitor(myMonitor); cc.initialize(); listCControllers.addItem(cc); } catch (Exception e) { } } } listCControllers.setActionCommand(cmdCtrlList); listCControllers.addActionListener(this); pcl.add(listCControllers); pcl.add(buttonProp); confPanel.add(pcl); return; }
private void initialize() { setName("NewsPanel"); setLayout(new GridBagLayout()); refreshLanguage(); // We create the components new TextComponentClipboardMenu(uploadPrioTextField, language); new TextComponentClipboardMenu(downloadPrioTextField, language); new TextComponentClipboardMenu(displayDaysTextField, language); new TextComponentClipboardMenu(downloadDaysTextField, language); new TextComponentClipboardMenu(messageBaseTextField, language); new TextComponentClipboardMenu(minimumIntervalTextField, language); new TextComponentClipboardMenu(concurrentUpdatesTextField, language); new TextComponentClipboardMenu(altEditTextField, language); // Adds all of the components final GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; constraints.weighty = 0.0; constraints.weightx = 0; constraints.insets = new Insets(0, 5, 5, 5); constraints.gridy = 0; constraints.gridx = 0; add(displayDaysLabel, constraints); constraints.gridx = 1; add(displayDaysTextField, constraints); constraints.gridx = 0; constraints.gridy++; add(downloadDaysLabel, constraints); constraints.gridx = 1; add(downloadDaysTextField, constraints); constraints.gridx = 0; constraints.gridy++; constraints.gridwidth = 2; add(alwaysDownloadBackloadCheckBox, constraints); constraints.gridwidth = 1; constraints.gridx = 0; constraints.gridy++; add(messageBaseLabel, constraints); constraints.gridx = 1; add(messageBaseTextField, constraints); constraints.gridy++; constraints.gridx = 0; add(uploadPrioLabel, constraints); constraints.gridx = 1; add(uploadPrioTextField, constraints); constraints.gridy++; constraints.gridx = 0; add(downloadPrioLabel, constraints); constraints.gridx = 1; add(downloadPrioTextField, constraints); constraints.gridx = 0; constraints.gridwidth = 2; constraints.gridy++; add(automaticBoardUpdateCheckBox, constraints); constraints.gridy++; add(getUpdatePanel(), constraints); constraints.gridy++; add(useOneConnectionForMessagesCheckBox, constraints); constraints.gridy++; add(storeSentMessagesCheckBox, constraints); constraints.gridy++; add(silentlyRetryCheckBox, constraints); constraints.gridwidth = 1; constraints.insets = new Insets(0, 5, 0, 5); constraints.gridy++; constraints.gridx = 0; add(altEditCheckBox, constraints); constraints.gridx = 1; constraints.weightx = 1; constraints.fill = GridBagConstraints.HORIZONTAL; add(altEditTextField, constraints); constraints.weightx = 0; constraints.fill = GridBagConstraints.NONE; // glue constraints.gridy++; constraints.gridx = 0; constraints.gridwidth = 2; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1; constraints.weighty = 1; add(new JLabel(""), constraints); // Add listeners automaticBoardUpdateCheckBox.addActionListener(listener); altEditCheckBox.addChangeListener(listener); }
public FloorEditorWindow() { previewModeBox.addActionListener( new ActionListener() { /** Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { previewBox.setMode( FloorPreviewPanel.FloorPreviewMode.values()[previewModeBox.getSelectedIndex()]); loadFloor(); } }); final ChangeListener cl = new ChangeListener() { public void stateChanged(ChangeEvent e) { if (currentFloor == null || isLoading) return; isDirty = true; currentFloor.occlude = blendingCheckbox.isSelected(); switch (previewBox.getMode()) { case RT3_GAME: currentFloor.colour2 = gameColour.getColour(); currentFloor.rgb2hls(currentFloor.colour2, true); currentFloor.texture = (Integer) gameTexture.getValue(); currentFloor.name = gameName.getText(); break; case RT3_MAP: currentFloor.minimapColour = gameColour.getColour(); currentFloor.rgb2hls(currentFloor.minimapColour, false); break; case RT4P_OVERLAY: currentFloor.hdColour = gameColour.getColour(); int hslColour = currentFloor.hslColour; currentFloor.rgb2hls(currentFloor.hdColour, false); currentFloor.hdOlHslColour = hslColour; currentFloor.hslColour = hslColour; currentFloor.hdTexture = (Integer) gameTexture.getValue(); // currentFloor.name = gameName.getText(); break; case RT4P_UNDERLAY: currentFloor.hdUlColour = gameColour.getColour(); hslColour = currentFloor.hslColour; currentFloor.rgb2hls(currentFloor.hdUlColour, false); currentFloor.hdHslColour = hslColour; currentFloor.hslColour = hslColour; currentFloor.hdUlTexture = (Integer) gameTexture.getValue(); // currentFloor.name = gameName.getText(); break; } previewBox.repaint(); } }; gameColour.addChangeListener(cl); gameTexture.addChangeListener(cl); blendingCheckbox.addChangeListener(cl); gameName.addFocusListener( new FocusListener() { String text = ""; public void focusGained(FocusEvent e) { text = gameName.getText(); } public void focusLost(FocusEvent e) { if (!gameName.getText().equals(text)) cl.stateChanged(null); } }); resetButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if ((!isDirty) || JOptionPane.showConfirmDialog( mainPane, "Are you sure you want to revert all changes to this floor?", "RuneScape Map Editor", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) currentFloor = loadedFloor.cloneFLO(); } }); saveButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { isDirty = false; loadedFloor.replace(currentFloor); Floor.cache[loadedFloor.id] = loadedFloor; for (ChangeListener l : listenerList) l.stateChanged(null); } }); saveAsNewButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { isDirty = false; int i = Floor.addNew(currentFloor); currentFloor.id = i; loadedFloor = Floor.cache[i]; for (ChangeListener l : listenerList) l.stateChanged(null); } }); }
public BeastDialog(final JFrame frame, final String titleString, final Icon icon) { this.frame = frame; optionPanel = new OptionsPanel(12, 12); // this.frame = frame; JPanel panel = new JPanel(new BorderLayout()); panel.setOpaque(false); final OptionsPanel optionPanel3 = new OptionsPanel(0, 3); final JLabel titleIcon = new JLabel(); titleIcon.setIcon(icon); final JLabel titleText = new JLabel(titleString); optionPanel3.addComponent(titleText); // final JButton aboutButton = new JButton("About BEAST..."); // //aboutButton.setAction(); // optionPanel3.addComponent(aboutButton); optionPanel.addComponents(titleIcon, optionPanel3); final JButton inputFileButton = new JButton("Choose File..."); final JTextField inputFileNameText = new JTextField("not selected", 16); inputFileButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { FileDialog dialog = new FileDialog(frame, "Select target file...", FileDialog.LOAD); dialog.setVisible(true); if (dialog.getFile() == null) { // the dialog was cancelled... return; } inputFile = new File(dialog.getDirectory(), dialog.getFile()); inputFileNameText.setText(inputFile.getName()); } }); inputFileNameText.setEditable(false); JPanel panel1 = new JPanel(new BorderLayout(0, 0)); panel1.add(inputFileNameText, BorderLayout.CENTER); panel1.add(inputFileButton, BorderLayout.EAST); inputFileNameText.setToolTipText( "<html>Drag a BEAST XML file here or use the button to<br>" + "select one from a file dialog box.</html>"); inputFileButton.setToolTipText( "<html>Drag a BEAST XML file here or use the button to<br>" + "select one from a file dialog box.</html>"); optionPanel.addComponentWithLabel("BEAST XML File: ", panel1); Color focusColor = UIManager.getColor("Focus.color"); Border focusBorder = BorderFactory.createMatteBorder(2, 2, 2, 2, focusColor); new FileDrop( null, inputFileNameText, focusBorder, new FileDrop.Listener() { public void filesDropped(java.io.File[] files) { inputFile = files[0]; inputFileNameText.setText(inputFile.getName()); } // end filesDropped }); // end FileDrop.Listener overwriteCheckBox.setToolTipText( "<html>Specify whether BEAST will overwrite existing log files<br>" + "with the same name.</html>"); optionPanel.addComponent(overwriteCheckBox); optionPanel.addSeparator(); seedText.setColumns(12); seedText.setToolTipText( "<html>Specify a particular random number seed to replicate<br>" + "precisely the sequence of steps in the MCMC chain. By<br>" + "default this uses system information to provide a new<br>" + "seed each run.</html>"); optionPanel.addComponentWithLabel("Random number seed: ", seedText); threadsCombo.setToolTipText( "<html>Specify how large a thread pool to use.<br>" + "In most circumstances this should be set to 'automatic'<br>" + "but in some circumstances it may be desirable to restict<br>" + "the number of cores being used. 0 will turn off threading</html>"); optionPanel.addComponentWithLabel("Thread pool size: ", threadsCombo); optionPanel.addSeparator(); optionPanel.addSpanningComponent(beagleCheckBox); beagleCheckBox.setSelected(true); final OptionsPanel optionPanel1 = new OptionsPanel(0, 6); // optionPanel1.setBorder(BorderFactory.createEmptyBorder()); optionPanel1.setBorder(new TitledBorder("")); OptionsPanel optionPanel2 = new OptionsPanel(0, 3); optionPanel2.setBorder(BorderFactory.createEmptyBorder()); final JLabel label1 = optionPanel2.addComponentWithLabel("Prefer use of: ", beagleResourceCombo); optionPanel2.addComponent(beagleSSECheckBox); beagleSSECheckBox.setSelected(true); final JLabel label2 = optionPanel2.addComponentWithLabel("Prefer precision: ", beaglePrecisionCombo); final JLabel label3 = optionPanel2.addComponentWithLabel("Rescaling scheme: ", beagleScalingCombo); optionPanel2.addComponent(beagleInfoCheckBox); optionPanel2.setBorder(BorderFactory.createEmptyBorder()); optionPanel1.addComponent(optionPanel2); final JEditorPane beagleInfo = new JEditorPane( "text/html", "<html><div style=\"font-family:'helvetica neue light',helvetica,sans-serif;font-size:12;\"><p>BEAGLE is a high-performance phylogenetic library that can make use of<br>" + "additional computational resources such as graphics boards. It must be<br>" + "downloaded and installed independently of BEAST:</p>" + "<pre><a href=\"http://beagle-lib.googlecode.com/\">http://beagle-lib.googlecode.com/</a></pre></div>"); beagleInfo.setOpaque(false); beagleInfo.setEditable(false); beagleInfo.addHyperlinkListener(new SimpleLinkListener()); optionPanel1.addComponent(beagleInfo); optionPanel1.setBorder(BorderFactory.createEmptyBorder()); optionPanel.addSpanningComponent(optionPanel1); beagleInfoCheckBox.setEnabled(false); beagleCheckBox.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { beagleInfo.setEnabled(beagleCheckBox.isSelected()); beagleInfoCheckBox.setEnabled(beagleCheckBox.isSelected()); label1.setEnabled(beagleCheckBox.isSelected()); beagleResourceCombo.setEnabled(beagleCheckBox.isSelected()); beagleSSECheckBox.setEnabled(beagleCheckBox.isSelected()); label2.setEnabled(beagleCheckBox.isSelected()); beaglePrecisionCombo.setEnabled(beagleCheckBox.isSelected()); label3.setEnabled(beagleCheckBox.isSelected()); beagleScalingCombo.setEnabled(beagleCheckBox.isSelected()); } }); beagleCheckBox.setSelected(false); beagleResourceCombo.setSelectedItem("CPU"); }