private void init() { agents = new JComboBox(model); agents.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { stateChanged(event); } }); agents.addActionListener(TextChangesListener.getInstance()); ctm = new CreationTableModel(); datatable = new JTable(ctm); datatable.setShowGrid(false); datatable.setEnabled(false); datatable.setTableHeader(null); datatable.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3)); JPanel apanel = new JPanel(new BorderLayout()); apanel.add(new JLabel("Who took the photo: "), BorderLayout.WEST); apanel.add(agents, BorderLayout.CENTER); JPanel tablePanel = new JPanel(new BorderLayout()); tablePanel.add(new JScrollPane(datatable), BorderLayout.CENTER); datatable.getColumnModel().getColumn(0).setMaxWidth(120); datatable.getColumnModel().getColumn(0).setMinWidth(80); datatable.addKeyListener(TextChangesListener.getInstance()); this.add( ComponentFactory.createTitledPanel("Creator of the image:", apanel), BorderLayout.NORTH); this.add( ComponentFactory.createTitledPanel("Creation, EXIF & technical information:", tablePanel), BorderLayout.CENTER); this.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.WEST); }
private void createUI() { ShowMaxAction showMaxAction = new ShowMaxAction(); showMaxCheckBox = new JCheckBox(showMaxAction); showMaxCheckBox.setOpaque(false); showMaxCheckBox.setSelected(true); saveFileChooser = new JFileChooser(); saveFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); FileFilter pngFileFilter = new PngFileFilter(); saveFileChooser.setFileFilter(pngFileFilter); graphImageFactories = new GraphImageProducer[] { new TwentyMinutesProducer(mainFrame), new TwoHoursProducer(mainFrame), new TenHoursProducer(mainFrame), new OneDayProducer(mainFrame), new SevenDaysProducer(mainFrame), new ThirtyDaysProducer(mainFrame), new NinetyDaysProducer(mainFrame), new OneYearProducer(mainFrame), }; JPanel graphPanel = new JPanel(new GridLayout(1, 1)); graphLabel = new JLabel(); graphPanel.add(graphLabel); setLayout(new BorderLayout()); add(graphPanel, BorderLayout.CENTER); timerangeComboBox = new JComboBox( new Object[] { "20 minutes", "2 hours", "10 hours", "1 day", "7 days", "30 days", "90 days", "1 year", }); timerangeComboBox.addActionListener(new TimerangeActionListener()); sourcesComboBox = new JComboBox(); sourcesComboBox.addActionListener(new SourcesActionListener()); JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.add(new JLabel("Source: ")); toolbar.add(sourcesComboBox); toolbar.addSeparator(); toolbar.add(new JLabel("Timerange: ")); toolbar.add(timerangeComboBox); toolbar.add(showMaxCheckBox); toolbar.addSeparator(); toolbar.add(new JButton(new SaveAction())); add(toolbar, BorderLayout.NORTH); setSelectedGraph(0); }
public GlobalAttributes() { setLayout(new BorderLayout()); LabelledList list = new LabelledList(includeAggregationMethodAttributes() ? "Add Data..." : "Redraw"); add(list, BorderLayout.CENTER); if (includeAggregationMethodAttributes()) { NumberTextField stepsField = new NumberTextField(1, true) { public double newValue(double value) { value = (long) value; if (value <= 0) return currentValue; else { interval = (long) value; return value; } } }; list.addLabelled("Every", stepsField); list.addLabelled("", new JLabel("...Timesteps")); String[] optionsLabel = {"Current", "Maximum", "Minimum", "Mean"}; final JComboBox optionsBox = new JComboBox(optionsLabel); optionsBox.setSelectedIndex(aggregationMethod); optionsBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { aggregationMethod = optionsBox.getSelectedIndex(); } }); list.addLabelled("Using", optionsBox); } String[] optionsLabel2 = new String[] { "When Adding Data", "Every 0.1 Seconds", "Every 0.5 Seconds", "Every Second", "Every 2 Seconds", "Every 5 Seconds", "Every 10 Seconds", "Never" }; final JComboBox optionsBox2 = new JComboBox(optionsLabel2); optionsBox2.setSelectedIndex(redraw); optionsBox2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { redraw = optionsBox2.getSelectedIndex(); generator.update(); // keep up-to-date } }); if (includeAggregationMethodAttributes()) list.addLabelled("Redraw", optionsBox2); else list.add(optionsBox2); }
public void buildPopulationBox() { rebuilding = true; populationBox.removeAll(); peopleList = new ArrayList<Object>(); famList = new ArrayList<Family>(); peopleList.addAll(ctxt.individualCensus); String plur = (peopleList.size() == 1 ? "" : "s"); populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS)); populationBox.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "Current Population")); populationBox.setAlignmentX(0.5f); populationBox.add(Box.createRigidArea(new Dimension(8, 0))); indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur); indivLabel.setAlignmentX(0.5f); populationBox.add(indivLabel); if (peopleList.size() > 0) { JPanel indivBtnBox = new JPanel(); indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS)); Dimension sizer2 = new Dimension(350, 50); String[] indMenu = genIndMenu(peopleList); indPick = new JComboBox(indMenu); indPick.addActionListener(listener); indPick.setActionCommand("view/edit person"); indPick.setMinimumSize(sizer2); indPick.setMaximumSize(sizer2); indPick.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "View/Edit Person")); indivBtnBox.add(indPick); populationBox.add(indivBtnBox); } // end of if-any-people-exist famList.addAll(ctxt.familyCensus); // end of filtering deleted records plur = (famList.size() == 1 ? "y" : "ies"); famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur); famLabel.setAlignmentX(0.5f); populationBox.add(Box.createRigidArea(new Dimension(0, 4))); populationBox.add(famLabel); if (famList.size() > 0) { JPanel famBtnBox = new JPanel(); famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS)); Dimension sizer2 = new Dimension(350, 50); String[] famMenu = genFamMenu(famList); famPick = new JComboBox(famMenu); famPick.addActionListener(listener); famPick.setActionCommand("view/edit family"); famPick.setMinimumSize(sizer2); famPick.setMaximumSize(sizer2); famPick.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "View/Edit Family")); famBtnBox.add(famPick); populationBox.add(famBtnBox); } // end of if-any-families-exist rebuilding = false; } // end of method buildPopulationBox
/* Post: sets up all the options visually */ public Options() { valuesArray = new ArrayList<Integer>(); populateRandomArray(); // size of the array enterSize = new JLabel("Array size:"); arraySizeEntry = new JTextField("", 3); arraySizeEntry.addActionListener(this); arraySizeEntry.getDocument().addDocumentListener(new DocListener()); // algorithm on top topAlgo = new JLabel("Top:"); String[] topAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"}; chooseTopAlgo = new JComboBox(topAlgos); chooseTopAlgo.addActionListener(this); // algorithm on bottom bottomAlgo = new JLabel("Bottom:"); String[] bottomAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"}; chooseBottomAlgo = new JComboBox(bottomAlgos); chooseBottomAlgo.addActionListener(this); // average case or worst case caseLabel = new JLabel("Choose case:"); String[] cases = {"Average Case", "Worst Case"}; chooseCase = new JComboBox(cases); chooseCase.addActionListener(this); // delay of comparisons in the visualizer enterSpeed = new JLabel("Delay:"); speedEntry = new JTextField("10", 2); speedEntry.addActionListener(this); speedEntry.getDocument().addDocumentListener(this); // run button (runs the visualizer) run = new JButton("Run"); run.addActionListener(this); // adding everything to the panel add(enterSize); add(arraySizeEntry); add(topAlgo); add(chooseTopAlgo); add(bottomAlgo); add(chooseBottomAlgo); add(caseLabel); add(chooseCase); add(enterSpeed); add(speedEntry); add(run); }
/** Method that creates the JComponents. */ public void makeJComponents() { // button. choiceBox = new JComboBox(choiceArray); choiceBox.setEditable(false); choiceBox.addActionListener(this); }
@Override public JComponent createForm() { JComponent component = super.createForm(); annotationComboBox.setRenderer( new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value != null) { Annotation annotation = (Annotation) value; this.setText(annotation.getBrief()); } else { this.setText("-- select annotation --"); } return this; } }); component.setLayout(new FormLayout("right:p, 4dlu, left:p", "p, 4dlu, p, 4dlu, p, 4dlu, p")); CellConstraints cc = new CellConstraints(); component.add(getLabel("annotationLabel"), cc.xy(1, 1)); component.add(annotationComboBox, cc.xy(3, 1)); component.add(getLabel("patternLabel"), cc.xy(1, 3)); component.add(patternField, cc.xy(3, 3)); component.add(getLabel("ciLabel"), cc.xy(1, 5)); component.add(caseInsensitive, cc.xy(3, 5)); component.add(getLabel("remove"), cc.xy(1, 7)); component.add(removeMatched, cc.xy(3, 7)); patternField.setEnabled(false); caseInsensitive.setSelected(true); caseInsensitive.setEnabled(false); // action listener will fill out a suggested pattern for selected annotation types annotationComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object obj = annotationComboBox.getSelectedItem(); if (obj == null) { patternField.setEnabled(false); caseInsensitive.setEnabled(false); setEnabled(false); } else { patternField.setEnabled(true); caseInsensitive.setEnabled(true); patternField.setText(getDefault(obj.getClass())); patternField.setCaretPosition(0); setEnabled(true); } } }); return component; }
@Override protected JComponent createNorthPanel() { JBLabel descriptionLabel = new JBLabel("<html>" + makeDescription() + "</html>"); final JComboBox repositorySelector = new JComboBox(ArrayUtil.toObjectArray(myRepositories, GitRepository.class)); repositorySelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repositorySelector)); repositorySelector.setSelectedItem(myInitialRepository); repositorySelector.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { List<GitCommit> commits = myCommits.get((GitRepository) repositorySelector.getSelectedItem()); myCommitListWithDiffPanel.setCommits(new ArrayList<GitCommit>(commits)); } }); JPanel repoSelectorPanel = new JPanel(new BorderLayout()); JBLabel label = new JBLabel("Repository: "); label.setLabelFor(repoSelectorPanel); repoSelectorPanel.add(label, BorderLayout.WEST); repoSelectorPanel.add(repositorySelector); if (myRepositories.size() < 2) { repoSelectorPanel.setVisible(false); } JPanel northPanel = new JPanel(new BorderLayout()); northPanel.add(descriptionLabel); northPanel.add(repoSelectorPanel, BorderLayout.SOUTH); return northPanel; }
private void createComponents(JPanel p) { String tt = "Any of these: 45.5 -120.2 or 45 30 0 n 120 12 0 w or Seattle"; JComboBox field = new JComboBox(); field.setOpaque(false); field.setEditable(true); field.setLightWeightPopupEnabled(false); field.setPreferredSize(new Dimension(200, field.getPreferredSize().height)); field.setToolTipText(tt); JLabel label = new JLabel(ImageLibrary.getIcon("gov/nasa/worldwindow/images/safari-24x24.png")); // new // ImageIcon(getClass().getResource("gov/nasa/worldwindow/images/safari-24x24.png"))); label.setOpaque(false); label.setToolTipText(tt); p.add(label, BorderLayout.WEST); p.add(field, BorderLayout.CENTER); field.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { performGazeteerAction(actionEvent); } }); }
protected JComboBox getFileFileterComboBox(final FileTree ftree) { String[] filters = { "Artemis Files", "Sequence Files", "Feature Files", "All Files" }; final JComboBox comboFilter = new JComboBox(filters); comboFilter.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String select = (String) comboFilter.getSelectedItem(); if (select.equals("Artemis Files")) ftree.setFilter(getArtemisFilter()); else if (select.equals("Sequence Files")) ftree.setFilter(getSequenceFilter()); else if (select.equals("Feature Files")) ftree.setFilter(getFeatureFilter()); else if (select.equals("All Files")) { ftree.setFilter( new FileFilter() { public boolean accept(File pathname) { if (pathname.getName().startsWith(".")) return false; return true; } }); } } }); return comboFilter; }
private JComboBox getOptionsRenderingMethodComboBox() { if (optionsRenderingMethodComboBox == null) { optionsRenderingMethodComboBox = new JComboBox(new String[] {"Default", "Quality", "Speed"}); optionsRenderingMethodComboBox.addActionListener(eventHandler); } return optionsRenderingMethodComboBox; }
private JComboBox getOptionsRenderingAntialiasingComboBox() { if (optionsRenderingAntialiasingComboBox == null) { optionsRenderingAntialiasingComboBox = new JComboBox(new String[] {"Default", "On", "Off"}); optionsRenderingAntialiasingComboBox.addActionListener(eventHandler); } return optionsRenderingAntialiasingComboBox; }
public ComboBoxDemo() { super(new BorderLayout()); String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Pig"}; // Create the combo box, select the item at index 4. // Indices start at 0, so 4 specifies the pig. JComboBox petList = new JComboBox(petStrings); petList.setSelectedIndex(4); petList.addActionListener(this); // Set up the picture. picture = new JLabel(); picture.setFont(picture.getFont().deriveFont(Font.ITALIC)); picture.setHorizontalAlignment(JLabel.CENTER); updateLabel(petStrings[petList.getSelectedIndex()]); picture.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); // The preferred size is hard-coded to be the width of the // widest image and the height of the tallest image + the border. // A real program would compute this. picture.setPreferredSize(new Dimension(177, 122 + 10)); // Lay out the demo. add(petList, BorderLayout.PAGE_START); add(picture, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
public Mapper() { super("Action/Input Mapper"); setSize(500, 600); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel setupPane = new JPanel(new GridLayout(0, 1)); JPanel classPane = new JPanel(new BorderLayout()); classPane.add(new JLabel("Class: "), BorderLayout.WEST); classPane.add(nameF, BorderLayout.CENTER); classPane.add(stateC, BorderLayout.EAST); JPanel mapPane = new JPanel(); mapPane.add(inputB); mapPane.add(actionB); mapPane.add(bindingB); setupPane.add(classPane); setupPane.add(mapPane); getContentPane().add(setupPane, BorderLayout.NORTH); getContentPane().add(new JScrollPane(results), BorderLayout.CENTER); nameF.addActionListener(this); stateC.addActionListener(this); stateC.setEditable(false); new Probe().loadAudioActions(); // !!! setVisible(true); }
@Override public JComponent createOptionsPanel() { final JFormattedTextField valueField = prepareNumberEditor("m_limit"); final JComboBox comboBox = new ComboBox( new Object[] {Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED}); comboBox.setRenderer( new ListCellRendererWrapper() { @Override public void customize( JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value instanceof Scope) setText(((Scope) value).getText()); } }); comboBox.setSelectedItem(ignoreScope); comboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ignoreScope = (Scope) comboBox.getSelectedItem(); } }); comboBox.setPrototypeDisplayValue(Scope.PROTECTED); final FormBuilder formBuilder = FormBuilder.createFormBuilder(); formBuilder.addLabeledComponent(getConfigurationLabel(), valueField); formBuilder.addLabeledComponent( InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox); final JPanel panel = new JPanel(new BorderLayout()); panel.add(formBuilder.getPanel(), BorderLayout.NORTH); return panel; }
public HeaderPanel(String heading) { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setBackground(background); JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT); Font labelFont = new Font("Dialog", Font.BOLD, 18); panelLabel.setFont(labelFont); this.add(panelLabel); this.add(Box.createHorizontalGlue()); refresh = new JButton("Refresh"); refresh.addActionListener(this); this.add(refresh); this.add(Box.createHorizontalStrut(5)); root = new JComboBox(); Dimension d = root.getPreferredSize(); d.width = 90; root.setPreferredSize(d); root.setMaximumSize(d); File[] roots = directoryPane.getRoots(); for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath()); this.add(root); root.setSelectedIndex(directoryPane.getCurrentRootIndex()); root.addActionListener(this); this.add(Box.createHorizontalStrut(17)); }
HeatMapControls(ControlBar creator) { super(); parent = creator; setLayout(new BorderLayout()); super.setPreferredSize(new Dimension(255, 170)); String[] organisms = SpeciesTable.getOrganisms(); String[] options = new String[organisms.length + 1]; options[0] = "None"; for (int i = 0; i < organisms.length; i++) { options[i + 1] = organisms[i]; } species = new JComboBox(options); species.addActionListener(this); for (String str : SpeciesTable.getOrganisms()) {} super.add(species, BorderLayout.SOUTH); super.add(new Gradient(), BorderLayout.CENTER); super.add(new JLabel("Least"), BorderLayout.WEST); super.add(new JLabel("Most"), BorderLayout.EAST); super.add(new JLabel("Heat Map Controls"), BorderLayout.NORTH); super.setVisible(true); }
public void setIndexer(LibrariesIndexer indexer) { this.indexer = indexer; DropdownItem<DownloadableContribution> previouslySelectedCategory = (DropdownItem<DownloadableContribution>) categoryChooser.getSelectedItem(); DropdownItem<DownloadableContribution> previouslySelectedType = (DropdownItem<DownloadableContribution>) typeChooser.getSelectedItem(); categoryChooser.removeActionListener(categoryChooserActionListener); typeChooser.removeActionListener(typeChooserActionListener); // TODO: Remove setIndexer and make getContribModel // return a FilteredAbstractTableModel getContribModel().setIndexer(indexer); categoryFilter = null; categoryChooser.removeAllItems(); // Load categories categoryChooser.addItem(new DropdownAllItem()); Collection<String> categories = indexer.getIndex().getCategories(); for (String category : categories) { categoryChooser.addItem(new DropdownLibraryOfCategoryItem(category)); } categoryChooser.setEnabled(categoryChooser.getItemCount() > 1); categoryChooser.addActionListener(categoryChooserActionListener); if (previouslySelectedCategory != null) { categoryChooser.setSelectedItem(previouslySelectedCategory); } else { categoryChooser.setSelectedIndex(0); } typeFilter = null; typeChooser.removeAllItems(); typeChooser.addItem(new DropdownAllItem()); typeChooser.addItem(new DropdownInstalledLibraryItem(indexer.getIndex())); java.util.List<String> types = new LinkedList<String>(indexer.getIndex().getTypes()); Collections.sort(types, new LibraryTypeComparator()); for (String type : types) { typeChooser.addItem(new DropdownLibraryOfTypeItem(type)); } typeChooser.setEnabled(typeChooser.getItemCount() > 1); typeChooser.addActionListener(typeChooserActionListener); if (previouslySelectedType != null) { typeChooser.setSelectedItem(previouslySelectedType); } else { typeChooser.setSelectedIndex(0); } filterField.setEnabled(contribModel.getRowCount() > 0); // Create LibrariesInstaller tied with the provided index installer = new LibraryInstaller(indexer, platform) { @Override public void onProgress(Progress progress) { setProgress(progress); } }; }
public DemoControls(ImageOps demo) { super(demo.name); this.demo = demo; setBackground(Color.gray); add(imgCombo = new JComboBox()); imgCombo.setFont(font); for (int i = 0; i < ImageOps.imgName.length; i++) { imgCombo.addItem(ImageOps.imgName[i]); } imgCombo.addActionListener(this); add(opsCombo = new JComboBox()); opsCombo.setFont(font); for (int i = 0; i < ImageOps.opsName.length; i++) { opsCombo.addItem(ImageOps.opsName[i]); } opsCombo.addActionListener(this); }
private JComboBox getOptionsRenderingNoBuffersComboBox() { if (optionsRenderingNoBuffersComboBox == null) { optionsRenderingNoBuffersComboBox = new JComboBox(new String[] {"Single buffering", "Double buffering", "Triple buffering"}); optionsRenderingNoBuffersComboBox.addActionListener(eventHandler); } return optionsRenderingNoBuffersComboBox; }
public ComboBoxDemo2() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z", "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" }; currentPattern = patternExamples[0]; // Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Enter the pattern string or"); JLabel patternLabel2 = new JLabel("select one from the list:"); JComboBox patternList = new JComboBox(patternExamples); patternList.setEditable(true); patternList.addActionListener(this); // Create the UI for displaying result. JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); // == LEFT result = new JLabel(" "); result.setForeground(Color.black); result.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // Lay out everything. JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternList.setAlignmentX(Component.LEFT_ALIGNMENT); patternPanel.add(patternList); JPanel resultPanel = new JPanel(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT); resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternPanel); add(Box.createRigidArea(new Dimension(0, 10))); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); } // constructor
private void initComponents() { setLayout(new BorderLayout(8, 5)); JPanel northPanel = new JPanel(); northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.PAGE_AXIS)); JLabel label; label = new JLabel("Chart title :"); northPanel.add(label); title = new JTextField(chartName); northPanel.add(title); label = new JLabel("X Axis title :"); northPanel.add(label); xAxisTitle = new JTextField(); northPanel.add(xAxisTitle); label = new JLabel("Y Axis title :"); northPanel.add(label); yAxisTitle = new JTextField(); northPanel.add(yAxisTitle); label = new JLabel("Available plotters :"); northPanel.add(label); plotters = new JComboBox(); for (String plot : PlotterManager.getInstance().getAvailablePlotters()) { plotters.addItem(plot); } ; plotters.addActionListener(new SelectPlotterListener()); northPanel.add(plotters); add(northPanel, BorderLayout.NORTH); params = new ParamTable(3); add( new JScrollPane(params) { public Dimension getPreferredSize() { int width = super.getPreferredSize().width; int height = params.getRowHeight() * 6; return new Dimension(width, height); } }, BorderLayout.CENTER); JButton accept = new JButton("Plot Chart"); accept.addActionListener(new AcceptListener()); add(accept, BorderLayout.SOUTH); plotters.setSelectedIndex(0); }
// WTF: this does not update packs!! // only updating info for selected pack. pulldown menus and info area! void updatePacks() { for (int i = 0; i < packPanels.size(); i++) { if (selectedPack == i && getIndex() >= 0) { ModPack pack = ModPack.getPackArray().get(getIndex()); if (pack != null) { String mods = ""; if (pack.getMods() != null) { mods += "<p>This pack contains the following mods by default:</p><ul>"; for (String name : pack.getMods()) { mods += "<li>" + name + "</li>"; } mods += "</ul>"; } packPanels.get(i).setBackground(UIManager.getColor("control").darker().darker()); packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); File tempDir = new File( OSUtils.getCacheStorageLocation(), "ModPacks" + File.separator + pack.getDir()); packInfo.setText( "<html><img src='file:///" + tempDir.getPath() + File.separator + pack.getImageName() + "' width=400 height=200></img> <br>" + pack.getInfo() + mods); packInfo.setCaretPosition(0); if (ModPack.getSelectedPack(isFTB()).getServerUrl().equals("") || ModPack.getSelectedPack(isFTB()).getServerUrl() == null) { server.setEnabled(false); } else { server.setEnabled(true); } String tempVer = Settings.getSettings().getPackVer(pack.getDir()); version.removeActionListener(al); version.removeAllItems(); version.addItem("Recommended"); if (pack.getOldVersions() != null) { for (String s : pack.getOldVersions()) { version.addItem(s); } version.setSelectedItem(tempVer); } version.addActionListener(al); } } else { packPanels.get(i).setBackground(UIManager.getColor("control")); packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } } }
/** Parse clicks to cancel the recording if we get a click that's not in the JList (or ESC). */ protected boolean parseClick(AWTEvent event) { if (isFinished()) { return false; } // FIXME add key-based activation/termination? boolean consumed = true; if (combo == null) { combo = getComboBox(event); listener = new ActionListener() { public void actionPerformed(ActionEvent ev) { index = combo.getSelectedIndex(); if (!combo.isPopupVisible()) { combo.removeActionListener(listener); setFinished(true); } } }; combo.addActionListener(listener); setStatus("Waiting for selection"); } else if (event.getID() == KeyEvent.KEY_RELEASED && (((KeyEvent) event).getKeyCode() == KeyEvent.VK_SPACE || ((KeyEvent) event).getKeyCode() == KeyEvent.VK_ENTER)) { index = combo.getSelectedIndex(); setFinished(true); } // Cancel via click somewhere else else if (event.getID() == MouseEvent.MOUSE_PRESSED && !AWT.isOnPopup((Component) event.getSource()) && combo != getComboBox(event)) { setFinished(true); consumed = false; } // Cancel via ESC key else if (event.getID() == KeyEvent.KEY_RELEASED && ((KeyEvent) event).getKeyCode() == KeyEvent.VK_ESCAPE) { setStatus("Selection canceled"); setFinished(true); } else { Log.debug("Event ignored"); } if (list == null && combo.isPopupVisible()) list = tester.findComboList(combo); if (isFinished()) { combo.removeActionListener(listener); listener = null; } return consumed; }
@Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { empCat.setSelectedItem(value); empCat.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fireEditingStopped(); } }); return empCat; }
private void jbInit() throws Exception { this.getContentPane().setLayout(borderLayout2); formatPanel.setLayout(gridBagLayout1); formatPanel.setBorder(BorderFactory.createEtchedBorder()); formatLabel.setText(I18N.get("datasource.DataSourceQueryChooserDialog.format")); formatComboBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { formatComboBox_actionPerformed(e); } }); okCancelPanel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { okCancelPanel_actionPerformed(e); } }); this.getContentPane().add(mainPanel, BorderLayout.NORTH); this.getContentPane().add(formatPanel, BorderLayout.CENTER); this.getContentPane().add(okCancelPanel, BorderLayout.SOUTH); formatPanel.add( formatComboBox, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(16, 4, 16, 4), 0, 0)); formatPanel.add( formatLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(16, 4, 16, 4), 0, 0)); }
/** * Contruct a new AnimationWidget. * * @param parentf the parent JFrame * @param anim a ucar.visad.display.Animation object to manage * @param info Default values for the AnimationInfo */ public AnimationWidget(JFrame parentf, Animation anim, AnimationInfo info) { // Initialize sharing to true super("AnimationWidget", true); timesCbx = new JComboBox() { public String getToolTipText(MouseEvent event) { if (boxPanel != null) { return boxPanel.getToolTipText(); } return " "; } }; timesCbx.setToolTipText(""); timesCbxMutex = timesCbx.getTreeLock(); timesCbx.setFont(new Font("Dialog", Font.PLAIN, 9)); timesCbx.setLightWeightPopupEnabled(false); // set to non-visible until items are added timesCbx.setVisible(false); timesCbx.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (!ignoreTimesCbxEvents && (anime != null)) { debug("got timesCbx event"); setTimeFromUser((Real) timesCbx.getSelectedItem()); if (boxPanel != null) { boxPanel.setOnIndex(timesCbx.getSelectedIndex()); } } } }); animationInfo = new AnimationInfo(); if (anim != null) { setAnimation(anim); } if (anime != null) { animationInfo.set(anime.getAnimationInfo()); } if (info != null) { setProperties(info); animationInfo.setRunning(info.getRunning()); } boxPanel = new AnimationBoxPanel(this); if (timesArray != null) { updateBoxPanel(timesArray); } }
public BatchInputPanel(final ImagePropertyTable imageTable) { super(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); this.imageTable = imageTable; setupUI(); useBatchInputCheckbox.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { onBatch(); } }); applyToAllButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { onApply(true); } }); applyToSelectedButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { onApply(false); } }); orientationComboBox.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { final boolean enableLabel = (orientationComboBox.getSelectedIndex() != 2 /* [Blank] */); orientationLabel.setEnabled(enableLabel); } }); lengthField .getDocument() .addDocumentListener(LabelEnablerFactory.create(lengthField, lengthLabel)); dpiXField.getDocument().addDocumentListener(LabelEnablerFactory.create(dpiXField, dpiXLabel)); dpiYField.getDocument().addDocumentListener(LabelEnablerFactory.create(dpiYField, dpiYLabel)); startDepthField .getDocument() .addDocumentListener(LabelEnablerFactory.create(startDepthField, startDepthLabel)); depthIncField .getDocument() .addDocumentListener(LabelEnablerFactory.create(depthIncField, depthIncLabel)); }
public RunningBuy() { super(); setTitle("空闲房间查询"); setBounds(200, 40, 800, 600); setVisible(true); setLayout(null); JLabel roomkind = new JLabel("房间种类"); roomkind.setBounds(100, 80, 120, 40); add(roomkind); Container container = getContentPane(); container.add(jp); jp.setBounds(280, 80, 160, 40); jc.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { System.out.println(e.getItem()); } }); jc.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }); // int index=jc.getSelectedIndex(); jp.add(jc); JTextField tf = new JTextField(); tf.setBounds(100, 200, 300, 100); add(tf); /*if(index==1){ gconn.select("select `roomID` from `tb_room` where `roomtype`= '标准双人间' and `roomstate` = 'E'"); try{String selectid=gconn.hotelrs.getString("roomID"); tf.setText(selectid);} catch(Exception e){ e.printStackTrace(); System.out.println("插入失败"); } }//*/ }
/** Creates the property iterator panel initially disabled. */ public GeneratorPropertyIteratorPanel() { String[] options = {"Disabled", "Enabled"}; ComboBoxModel cbm = new DefaultComboBoxModel(options); m_StatusBox.setModel(cbm); m_StatusBox.setSelectedIndex(0); m_StatusBox.addActionListener(this); m_StatusBox.setEnabled(false); m_ConfigureBut.setEnabled(false); m_ConfigureBut.addActionListener(this); JPanel buttons = new JPanel(); GridBagLayout gb = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); buttons.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); // buttons.setLayout(new GridLayout(1, 2)); buttons.setLayout(gb); constraints.gridx = 0; constraints.gridy = 0; constraints.weightx = 5; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.insets = new Insets(0, 2, 0, 2); buttons.add(m_StatusBox, constraints); constraints.gridx = 1; constraints.gridy = 0; constraints.weightx = 5; constraints.gridwidth = 1; constraints.gridheight = 1; buttons.add(m_ConfigureBut, constraints); buttons.setMaximumSize( new Dimension(buttons.getMaximumSize().width, buttons.getMinimumSize().height)); setBorder(BorderFactory.createTitledBorder("Generator properties")); setLayout(new BorderLayout()); add(buttons, BorderLayout.NORTH); // add(Box.createHorizontalGlue()); m_ArrayEditor.setBorder(BorderFactory.createEtchedBorder()); m_ArrayEditor.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { System.err.println("Updating experiment property iterator array"); m_Exp.setPropertyArray(m_ArrayEditor.getValue()); } }); add(m_ArrayEditor, BorderLayout.CENTER); }