List of usage examples for javax.swing.border TitledBorder TitledBorder
public TitledBorder(Border border)
From source file:com.intuit.tank.tools.debugger.FindReplaceDialog.java
/** * Constructs a new find dialog according to the specified type of dialog requested. The dialog can be either a FIND * dialog, either a REPLACE dialog. In both cases, components displayed remain the sames, but the ones specific to * replace feature are grayed out.//from w ww . j a v a 2 s. co m * * @param parent * The window holder * @param type * The type of the dialog: FindReplace.FIND or FindReplace.REPLACE * @param modal * Displays dialog as a modal window if true */ public FindReplaceDialog(AgentDebuggerFrame parent, DialogType type) { super(parent, type == DialogType.REPLACE ? "Replace" : "Find", true); this.parent = parent; cbSearch = new JComboBox(); cbSearch.setEditable(true); cbReplace = new JComboBox(); cbReplace.setEditable(true); KeyHandler handler = new KeyHandler(); tfSearchEditor = (JTextField) cbSearch.getEditor().getEditorComponent(); tfSearchEditor.addKeyListener(handler); tfReplaceEditor = (JTextField) cbReplace.getEditor().getEditorComponent(); tfReplaceEditor.addKeyListener(handler); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); getContentPane().setLayout(gridbag); ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); int gridX = 0; int gridY = 0; JLabel findLabel = new JLabel("Find"); buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0); constraints.anchor = GridBagConstraints.WEST; gridbag.setConstraints(findLabel, constraints); getContentPane().add(findLabel); gridX++; buildConstraints(constraints, gridX, gridY, 1, 1, 100, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(cbSearch, constraints); getContentPane().add(cbSearch); gridX++; btnFind = new JButton("Find"); btnFind.setToolTipText("Find text in scripts"); btnFind.setMnemonic('F'); btnFind.addActionListener(this); buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0); constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(btnFind, constraints); getContentPane().add(btnFind); getRootPane().setDefaultButton(btnFind); gridX++; btnCancel = new JButton("Cancel"); btnCancel.setMnemonic('C'); btnCancel.addActionListener(this); buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0); constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(btnCancel, constraints); getContentPane().add(btnCancel); gridY++; gridX = 0; if (type == DialogType.REPLACE) { JLabel replaceLabel = new JLabel("Replace"); buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0); constraints.anchor = GridBagConstraints.WEST; gridbag.setConstraints(replaceLabel, constraints); getContentPane().add(replaceLabel); gridX++; buildConstraints(constraints, gridX, gridY, 1, 1, 100, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(cbReplace, constraints); getContentPane().add(cbReplace); gridX++; btnReplace = new JButton("Replace"); btnReplace.setToolTipText("REplace in script"); btnReplace.setMnemonic('R'); btnReplace.addActionListener(this); buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0); constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(btnReplace, constraints); getContentPane().add(btnReplace); gridX++; btnReplaceAll = new JButton("Replace All"); btnReplaceAll.addActionListener(this); buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0); constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(btnReplaceAll, constraints); getContentPane().add(btnReplaceAll); btnReplace.addKeyListener(handler); btnReplaceAll.addKeyListener(handler); gridY++; gridX = 0; } TitledBorder border = new TitledBorder("Options"); JPanel panel = new JPanel(new GridLayout(1, 4)); panel.setBorder(border); checkboxWrap = new JCheckBox("Wrap Search"); panel.add(checkboxWrap); checkboxMatchCase = new JCheckBox("Case sensitive"); panel.add(checkboxMatchCase); checkboxRegexp = new JCheckBox("Regular expressions"); panel.add(checkboxRegexp); buildConstraints(constraints, gridX, gridY, 4, 1, 100, 100); constraints.anchor = GridBagConstraints.WEST; gridbag.setConstraints(panel, constraints); getContentPane().add(panel); FontMetrics fm = getFontMetrics(getFont()); cbSearch.setPreferredSize(new Dimension(18 * fm.charWidth('m'), (int) cbSearch.getPreferredSize().height)); cbReplace .setPreferredSize(new Dimension(18 * fm.charWidth('m'), (int) cbReplace.getPreferredSize().height)); pack(); // setResizable(false); WindowUtil.centerOnParent(this); // patch by MJB 8/1/2002 btnFind.addKeyListener(handler); btnCancel.addKeyListener(handler); checkboxMatchCase.addKeyListener(handler); checkboxRegexp.addKeyListener(handler); }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingFrame.java
/** * Constructor./*from ww w . j a v a 2 s .c o m*/ */ public GapFillingFrame(final AbstractTabView atv, final Instances dataSet, final Attribute attr, final int dateIdx, final int valuesBeforeAndAfter, final int position, final int gapsize, final StationsDataProvider gcp, final boolean inBatchMode) { super(); setTitle("Gap filling for " + attr.name() + " (" + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position).value(dateIdx)) + " -> " + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position + gapsize).value(dateIdx)) + ")"); LogoHelper.setLogo(this); this.atv = atv; this.dataSet = dataSet; this.attr = attr; this.dateIdx = dateIdx; this.valuesBeforeAndAfter = valuesBeforeAndAfter; this.position = position; this.gapsize = gapsize; this.gcp = gcp; final Instances testds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0, dataSet.numAttributes() - 1, Math.max(0, position - valuesBeforeAndAfter), Math.min(position + gapsize + valuesBeforeAndAfter, dataSet.numInstances() - 1)); this.attrNames = WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(testds); this.isGapSimulated = (this.attrNames.contains(attr.name())); this.originaldataSet = new Instances(dataSet); if (this.isGapSimulated) { setTitle(getTitle() + " [SIMULATED GAP]"); /*final JXLabel fictiveGapLabel=new JXLabel(" FICTIVE GAP"); fictiveGapLabel.setForeground(Color.RED); fictiveGapLabel.setFont(new Font(fictiveGapLabel.getFont().getName(), Font.PLAIN,fictiveGapLabel.getFont().getSize()*2)); final JXPanel fictiveGapPanel=new JXPanel(); fictiveGapPanel.setLayout(new BorderLayout()); fictiveGapPanel.add(fictiveGapLabel,BorderLayout.CENTER); getContentPane().add(fictiveGapPanel,BorderLayout.NORTH);*/ this.attrNames.remove(attr.name()); this.originalDataBeforeGapSimulation = dataSet.attributeToDoubleArray(attr.index()); for (int i = position; i < position + gapsize; i++) dataSet.instance(i).setMissing(attr); } final Object[] attrNamesObj = this.attrNames.toArray(); this.centerPanel = new JXPanel(); this.centerPanel.setLayout(new BorderLayout()); getContentPane().add(this.centerPanel, BorderLayout.CENTER); //final JXPanel algoPanel=new JXPanel(); //getContentPane().add(algoPanel,BorderLayout.NORTH); final JXPanel filterPanel = new JXPanel(); //filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS)); filterPanel.setLayout(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(10, 10, 10, 10); getContentPane().add(filterPanel, BorderLayout.WEST); final JXComboBox algoCombo = new JXComboBox(Algo.values()); algoCombo.setBorder(new TitledBorder("Algorithm")); filterPanel.add(algoCombo, gbc); gbc.gridy++; final JXLabel infoLabel = new JXLabel("Usable = with no missing values on the period"); //infoLabel.setBorder(new TitledBorder("")); filterPanel.add(infoLabel, gbc); gbc.gridy++; final JList<Object> timeSeriesList = new JList<Object>(attrNamesObj); timeSeriesList.setBorder(new TitledBorder("Usable time series")); timeSeriesList.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION); final JScrollPane jcpMap = new JScrollPane(timeSeriesList); jcpMap.setPreferredSize(new Dimension(225, 150)); jcpMap.setMinimumSize(new Dimension(225, 150)); filterPanel.add(jcpMap, gbc); gbc.gridy++; final JXPanel mapPanel = new JXPanel(); mapPanel.setBorder(new TitledBorder("")); mapPanel.setLayout(new BorderLayout()); mapPanel.add(gcp.getMapPanel(Arrays.asList(attr.name()), this.attrNames, true), BorderLayout.CENTER); filterPanel.add(mapPanel, gbc); gbc.gridy++; final JXLabel mssLabel = new JXLabel( "<html>Most similar usable serie: <i>[... computation ...]</i></html>"); mssLabel.setBorder(new TitledBorder("")); filterPanel.add(mssLabel, gbc); gbc.gridy++; final JXLabel nsLabel = new JXLabel("<html>Nearest usable serie: <i>[... computation ...]</i></html>"); nsLabel.setBorder(new TitledBorder("")); filterPanel.add(nsLabel, gbc); gbc.gridy++; final JXLabel ussLabel = new JXLabel("<html>Upstream serie: <i>[... computation ...]</i></html>"); ussLabel.setBorder(new TitledBorder("")); filterPanel.add(ussLabel, gbc); gbc.gridy++; final JXLabel dssLabel = new JXLabel("<html>Downstream serie: <i>[... computation ...]</i></html>"); dssLabel.setBorder(new TitledBorder("")); filterPanel.add(dssLabel, gbc); gbc.gridy++; final JCheckBox hideOtherSeriesCB = new JCheckBox("Hide the others series"); hideOtherSeriesCB.setSelected(DEFAULT_HIDE_OTHER_SERIES_OPTION); filterPanel.add(hideOtherSeriesCB, gbc); gbc.gridy++; final JCheckBox showErrorCB = new JCheckBox("Show error on plot"); filterPanel.add(showErrorCB, gbc); gbc.gridy++; final JCheckBox zoomCB = new JCheckBox("Auto-adjusted size"); zoomCB.setSelected(DEFAULT_ZOOM_OPTION); filterPanel.add(zoomCB, gbc); gbc.gridy++; final JCheckBox multAxisCB = new JCheckBox("Multiple axis"); filterPanel.add(multAxisCB, gbc); gbc.gridy++; final JCheckBox showEnvelopeCB = new JCheckBox("Show envelope (all algorithms, SLOW)"); filterPanel.add(showEnvelopeCB, gbc); gbc.gridy++; final JXButton showModelButton = new JXButton("Show the model"); filterPanel.add(showModelButton, gbc); gbc.gridy++; showModelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JXFrame dialog = new JXFrame(); dialog.setTitle("Model"); LogoHelper.setLogo(dialog); dialog.getContentPane().removeAll(); dialog.getContentPane().setLayout(new BorderLayout()); final JTextPane modelTxtPane = new JTextPane(); modelTxtPane.setText(gapFiller.getModel()); modelTxtPane.setBackground(Color.WHITE); modelTxtPane.setEditable(false); final JScrollPane jsp = new JScrollPane(modelTxtPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jsp.setSize(new Dimension(400 - 20, 400 - 20)); dialog.getContentPane().add(jsp, BorderLayout.CENTER); dialog.setSize(new Dimension(400, 400)); dialog.setLocationRelativeTo(centerPanel); dialog.pack(); dialog.setVisible(true); } }); algoCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); showModelButton.setEnabled(gapFiller.hasExplicitModel()); } catch (final Exception e1) { e1.printStackTrace(); } } }); timeSeriesList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); mapPanel.removeAll(); final List<String> currentlySelected = new ArrayList<String>(); currentlySelected.add(attr.name()); for (final Object sel : timeSeriesList.getSelectedValues()) currentlySelected.add(sel.toString()); mapPanel.add(gcp.getMapPanel(currentlySelected, attrNames, true), BorderLayout.CENTER); } catch (final Exception e1) { e1.printStackTrace(); } } }); hideOtherSeriesCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (final Exception e1) { e1.printStackTrace(); } } }); showErrorCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); zoomCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); showEnvelopeCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); multAxisCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); this.inBatchMode = inBatchMode; if (!inBatchMode) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), new int[0], DEFAULT_HIDE_OTHER_SERIES_OPTION, false, DEFAULT_ZOOM_OPTION, false, false); showModelButton.setEnabled(gapFiller.hasExplicitModel()); } catch (Exception e1) { e1.printStackTrace(); } } if (!inBatchMode) { /* automatically select computed series */ new AbstractSimpleAsync<Void>(true) { @Override public Void execute() throws Exception { mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false); mssLabel.setText("<html>Most similar usable serie: <b>" + mostSimilar + "</b></html>"); nearest = gcp.findNearestStation(attr.name(), attrNames); nsLabel.setText("<html>Nearest usable serie: <b>" + nearest + "</b></html>"); upstream = gcp.findUpstreamStation(attr.name(), attrNames); if (upstream != null) { ussLabel.setText("<html>Upstream usable serie: <b>" + upstream + "</b></html>"); } else { ussLabel.setText("<html>Upstream usable serie: <b>N/A</b></html>"); } downstream = gcp.findDownstreamStation(attr.name(), attrNames); if (downstream != null) { dssLabel.setText("<html>Downstream usable serie: <b>" + downstream + "</b></html>"); } else { dssLabel.setText("<html>Downstream usable serie: <b>N/A</b></html>"); } timeSeriesList.setSelectedIndices( new int[] { attrNames.indexOf(mostSimilar), attrNames.indexOf(nearest), attrNames.indexOf(upstream), attrNames.indexOf(downstream) }); return null; } @Override public void onSuccess(final Void result) { } @Override public void onFailure(final Throwable caught) { caught.printStackTrace(); } }.start(); } else { try { mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false); } catch (Exception e1) { e1.printStackTrace(); } nearest = gcp.findNearestStation(attr.name(), attrNames); upstream = gcp.findUpstreamStation(attr.name(), attrNames); downstream = gcp.findDownstreamStation(attr.name(), attrNames); } }
From source file:com.univocity.app.swing.DataAnalysisWindow.java
protected JPanel getProcessPanel() { if (processPanel == null) { processPanel = new JPanel(); processPanel.setBorder(new TitledBorder("Process selection")); processPanel.setLayout(new BoxLayout(processPanel, BoxLayout.X_AXIS)); addWithSpace(processPanel, getProcessListLabel(), 2); addWithSpace(processPanel, getProcessList(), 2); addWithSpace(processPanel, getExecuteProcessButton(), 2); }//from ww w . ja va2s . co m return processPanel; }
From source file:dk.dma.epd.shore.gui.views.SendRouteDialog.java
/** * Initialize the GUI/*from w ww. j a v a 2s . c om*/ */ public void initGUI() { JPanel content = new JPanel(new GridBagLayout()); setContentPane(content); Insets insets1 = new Insets(5, 5, 5, 0); Insets insets2 = new Insets(5, 0, 5, 5); Insets insets5 = new Insets(5, 5, 5, 5); // ******************* // *** Target panel // ******************* JPanel targetPanel = new JPanel(new GridBagLayout()); targetPanel.setBorder(new TitledBorder("Target")); content.add(targetPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); mmsiListComboBox.addActionListener(this); targetPanel.add(new JLabel("MMSI:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); targetPanel.add(mmsiListComboBox, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); nameComboBox.addActionListener(this); targetPanel.add(new JLabel("Name:"), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); targetPanel.add(nameComboBox, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); chatBtn.setEnabled(false); chatBtn.addActionListener(this); targetPanel.add(new JLabel("Call Sign:"), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); targetPanel.add(callsignLbl, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); targetPanel.add(chatBtn, new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0, EAST, NONE, insets5, 0, 0)); statusLbl.setVisible(false); targetPanel.add(statusLbl, new GridBagConstraints(0, 3, 3, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); // ******************* // *** Route panel // ******************* JPanel routePanel = new JPanel(new GridBagLayout()); routePanel.setBorder(new TitledBorder("Route")); content.add(routePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); routeListComboBox.addActionListener(this); routePanel.add(new JLabel("Route name:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); routePanel.add(routeListComboBox, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); routePanel.add(new JLabel("Route length:"), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); routePanel.add(routeLengthLbl, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); int h = (int) departurePicker.getPreferredSize().getHeight(); initDatePicker(departurePicker, departureSpinner); routePanel.add(new JLabel("ETD:"), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); routePanel.add(fixSize(departurePicker, 120), new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); routePanel.add(fixSize(departureSpinner, 60, h), new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0)); initDatePicker(arrivalPicker, arrivalSpinner); routePanel.add(new JLabel("ETA:"), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); routePanel.add(fixSize(arrivalPicker, 120), new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0)); routePanel.add(fixSize(arrivalSpinner, 60, h), new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0)); speedTxtField.getDocument().addDocumentListener(new TextFieldChangeListener(speedTxtField)); speedTxtField.setHorizontalAlignment(JTextField.RIGHT); routePanel.add(new JLabel("Avg. speed:"), new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); routePanel.add(speedTxtField, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); zoomBtn.addActionListener(this); routePanel.add(zoomBtn, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); // ******************* // *** Send panel // ******************* JPanel sendPanel = new JPanel(new GridBagLayout()); sendPanel.setBorder(new TitledBorder("Send")); content.add(sendPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, CENTER, BOTH, insets5, 0, 0)); messageTxtField.setLineWrap(true); JScrollPane scrollPane = new JScrollPane(messageTxtField); scrollPane.setMinimumSize(new Dimension(180, 40)); scrollPane.setPreferredSize(new Dimension(180, 40)); sendPanel.add(new JLabel("Message:"), new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, NORTHWEST, NONE, insets5, 0, 0)); sendPanel.add(scrollPane, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, WEST, BOTH, insets5, 0, 0)); sendBtn.addActionListener(this); cancelBtn.addActionListener(this); sendPanel.add(sendBtn, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); sendPanel.add(cancelBtn, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, EAST, NONE, insets5, 0, 0)); }
From source file:de.freese.base.swing.mac_os_x.MyApp.java
/** * *///from www . ja v a 2s. c om public MyApp() { super("OSXAdapter"); addMenus(); // Main content area; set up a JLabel to display images selected by the user getContentPane().setLayout(new BorderLayout()); getContentPane().add(this.imageLabel = new JLabel("Open an image to view it")); this.imageLabel.setHorizontalAlignment(SwingConstants.CENTER); this.imageLabel.setVerticalAlignment(SwingConstants.CENTER); this.imageLabel.setOpaque(true); // set up a simple about box this.aboutBox = new JDialog(this, "About OSXAdapter"); this.aboutBox.getContentPane().setLayout(new BorderLayout()); this.aboutBox.getContentPane().add(new JLabel("OSXAdapter", SwingConstants.CENTER)); this.aboutBox.getContentPane().add(new JLabel("\u00A92003-2007 Apple, Inc.", SwingConstants.CENTER), BorderLayout.SOUTH); this.aboutBox.setSize(160, 120); this.aboutBox.setResizable(false); // Preferences dialog lets you select the background color when displaying an image this.prefs = new JDialog(this, "OSXAdapter Preferences"); this.colorComboBox = new JComboBox<>(this.colorNames); this.colorComboBox.addActionListener(new ActionListener() { /** * @see * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed(final ActionEvent ev) { if (MyApp.this.currentImage != null) { MyApp.this.imageLabel .setBackground(MyApp.this.colors[MyApp.this.colorComboBox.getSelectedIndex()]); } } }); JPanel masterPanel = new JPanel(); masterPanel.setBorder(new TitledBorder("Window background color:")); masterPanel.add(this.colorComboBox); this.prefs.getContentPane().add(masterPanel); this.prefs.setSize(240, 100); this.prefs.setResizable(false); // Set up our application to respond to the Mac OS X application menu registerForMacOSXEvents(); setSize(320, 240); }
From source file:com.funambol.admin.module.panels.DefaultSyncSourceConfigPanel.java
/** * Creates the panel/*from w w w . j a v a 2 s.com*/ */ private void init() { this.setLayout(null); titledBorder = new TitledBorder(""); panelName.setFont(GuiFactory.titlePanelFont); panelName.setText(Bundle.getMessage(Bundle.LABEL_SYNC_SOURCE_EDIT) + " " + sourceTypeDescription); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder); final int LABEL_X = 14; final int VALUE_X = 170; int y = 60; final int GAP_Y = 30; sourceUriLabel.setText(Bundle.getMessage(Bundle.LABEL_SYNC_SOURCE_URI) + ": "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line nameLabel.setText(Bundle.getMessage(Bundle.LABEL_SYNC_SOURCE_NAME) + ": "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line infoTypesLabel.setText(Bundle.getMessage(Bundle.LABEL_SYNC_SOURCE_SUPPORTED_TYPES) + ": "); infoTypesLabel.setFont(defaultFont); infoTypesLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); infoTypesValue.setFont(defaultFont); infoTypesValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line infoVersionsLabel.setText(Bundle.getMessage(Bundle.LABEL_SYNC_SOURCE_SUPPORTED_VERSIONS) + ": "); infoVersionsLabel.setFont(defaultFont); infoVersionsLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); infoVersionsValue.setFont(defaultFont); infoVersionsValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line int x = LABEL_X; encryption.setText(Bundle.getMessage(Bundle.LABEL_SYNC_SOURCE_ENCRYPTION)); encryption.setFont(defaultFont); encryption.setSelected(false); encryption.setBounds(x, y, 150, 25); // What happens if the encryption is enabled? encryption.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == e.SELECTED) { encoding.setSelected(true); // Encryption implies encoding encoding.setEnabled(false); } if (e.getStateChange() == e.DESELECTED) { encoding.setSelected(false); encoding.setEnabled(true); } } }); y += GAP_Y; // New line encoding.setText(Bundle.getMessage(Bundle.LABEL_SYNC_SOURCE_ENCODING)); encoding.setFont(defaultFont); encoding.setSelected(false); encoding.setBounds(x, y, 150, 25); y += GAP_Y; // New line y += GAP_Y; // New line confirmButton.setFont(defaultFont); confirmButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_ADD)); confirmButton.setBounds(VALUE_X, y, 70, 25); // What happens when the confirmButton is pressed? confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { DefaultSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( DefaultSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { DefaultSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( DefaultSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage())); } } }); // Adds all components to the panel this.add(panelName, null); this.add(nameLabel, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameValue, null); this.add(infoTypesLabel, null); this.add(infoTypesValue, null); this.add(infoVersionsLabel, null); this.add(infoVersionsValue, null); this.add(encryption, null); this.add(encoding, null); this.add(confirmButton, null); }
From source file:com.floreantpos.ui.OrderFilterPanel.java
private void createPaymentStatusFilterPanel() { btnFilterByOpenStatus = new POSToggleButton(PaymentStatusFilter.OPEN.toString()); btnFilterByPaidStatus = new POSToggleButton(PaymentStatusFilter.PAID.toString()); btnFilterByUnPaidStatus = new POSToggleButton(PaymentStatusFilter.CLOSED.toString()); final ButtonGroup paymentGroup = new ButtonGroup(); paymentGroup.add(btnFilterByOpenStatus); paymentGroup.add(btnFilterByPaidStatus); paymentGroup.add(btnFilterByUnPaidStatus); PaymentStatusFilter paymentStatusFilter = TerminalConfig.getPaymentStatusFilter(); switch (paymentStatusFilter) { case OPEN:/*from w w w . j av a 2s. c o m*/ btnFilterByOpenStatus.setSelected(true); break; case PAID: btnFilterByPaidStatus.setSelected(true); break; case CLOSED: btnFilterByUnPaidStatus.setSelected(true); break; } ActionListener psFilterHandler = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String actionCommand = e.getActionCommand(); if (actionCommand.equals("CLOSED") && !Application.getCurrentUser().hasPermission(UserPermission.VIEW_ALL_CLOSE_TICKETS)) { String password = PasswordEntryDialog.show(Application.getPosWindow(), "Please enter privileged password"); if (StringUtils.isEmpty(password)) { updateButton(); return; } User user2 = UserDAO.getInstance().findUserBySecretKey(password); if (user2 == null) { POSMessageDialog.showError(Application.getPosWindow(), "No user found with that secret key"); updateButton(); return; } else { if (!user2.hasPermission(UserPermission.VIEW_ALL_CLOSE_TICKETS)) { POSMessageDialog.showError(Application.getPosWindow(), "No permission"); updateButton(); return; } } } String filter = actionCommand.replaceAll("\\s", "_"); //$NON-NLS-1$ //$NON-NLS-2$ TerminalConfig.setPaymentStatusFilter(filter); ticketList.updateTicketList(); ticketLists.updateButtonStatus(); } }; btnFilterByOpenStatus.addActionListener(psFilterHandler); btnFilterByPaidStatus.addActionListener(psFilterHandler); btnFilterByUnPaidStatus.addActionListener(psFilterHandler); JPanel filterByPaymentStatusPanel = new JPanel(new MigLayout("", "fill, grow", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ filterByPaymentStatusPanel.setBorder(new TitledBorder(Messages.getString("SwitchboardView.3"))); //$NON-NLS-1$ filterByPaymentStatusPanel.add(btnFilterByOpenStatus); filterByPaymentStatusPanel.add(btnFilterByPaidStatus); filterByPaymentStatusPanel.add(btnFilterByUnPaidStatus); getContentPane().add(filterByPaymentStatusPanel); }
From source file:at.tuwien.ifs.feature.evaluation.SimilarityRetrievalGUI.java
public SimilarityRetrievalGUI() { super("Similarity Retrieval GUI"); setLayout(new GridBagLayout()); GridBagConstraintsIFS gcMain = new GridBagConstraintsIFS(GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // the panel with the feature files, allows to load new ones JPanel panelFeatureFiles = UiUtils.makeBorderedPanel(new VerticalLayout(), "Feature files"); getContentPane().add(panelFeatureFiles, gcMain); panelLoadedFeatureFiles.add(labelNoInputData); panelFeatureFiles.add(panelLoadedFeatureFiles); JButton btnLoad = initButtonLoad(); panelFeatureFiles.add(btnLoad);// w ww. j a v a 2s . c o m txtFieldMusicPath.setToolTipText("Path to the music"); // TODO: remove txtFieldMusicPath.setText("/data/music/ISMIRgenre/mp3_44khz_128kbit_stereo_30sec"); JButton btnBrowseMusicPath = UiUtils.createBrowseButton(txtFieldMusicPath, this, true); JPanel panelMusicPath = new JPanel(); panelMusicPath.add(new JLabel("Music path")); panelMusicPath.add(txtFieldMusicPath); panelMusicPath.add(btnBrowseMusicPath); panelFeatureFiles.add(panelMusicPath); initButtonStart(); initButtonSaveResults(); JRadioButton rbDistanceAbsolute = UiUtils.makeRadioButton("absolute", bgDistanceDisplay, true); bgDistanceDisplay.add(rbDistanceAbsolute); JRadioButton rbDistanceRelative = UiUtils.makeRadioButton("relative", bgDistanceDisplay); bgDistanceDisplay.add(rbDistanceRelative); initPanelRetrieval(); ((JSpinner.DefaultEditor) spinnerNumberNeighbours.getEditor()).getTextField().setColumns(6); panelRetrieval.setBorder(new TitledBorder("Options")); GridBagConstraintsIFS gc = new GridBagConstraintsIFS().setInsets(5, 2); panelRetrieval.add(new JLabel("# to retrieve"), gc); panelRetrieval.add(spinnerNumberNeighbours, gc.nextCol()); panelRetrieval.add(new JLabel("Query vector"), gc.nextRow()); panelRetrieval.add(comboQueryVector, gc.nextCol()); panelRetrieval.add(new JLabel("Distances"), gc.nextRow()); panelRetrieval.add(UiUtils.makeAndFillPanel(rbDistanceAbsolute, rbDistanceRelative), gc.nextCol()); boxMetric.setSelectedItem(L2Metric.class.getSimpleName()); panelRetrieval.add(new JLabel("Distance metric"), gc.nextRow()); panelRetrieval.add(boxMetric, gc.nextCol()); gc.nextRow().setGridWidth(2).setAnchor(GridBagConstraints.CENTER); panelRetrieval.add(UiUtils.makeAndFillPanel(btnStart, btnSaveResults), gc); panelRetrieval.setEnabled(false); getContentPane().add(panelRetrieval, gcMain.nextRow()); resizeResultTableColumns(); JScrollPane scrollPaneResults = new JScrollPane(resultsTable); scrollPaneResults.setBorder(new TitledBorder("Results")); getContentPane().add(scrollPaneResults, gcMain.nextRow()); databaseDetailsTable = new JTable(new DefaultTableModel(new Object[][] {}, databaseDetailsColumnNames)); databaseDetailsTable.setAutoCreateRowSorter(true); databaseDetailsTable.setDefaultEditor(JButton.class, new ButtonCellEditor()); resizeDatabaseDetailsTableColumns(); JScrollPane scrollPaneDatabaseDetails = new JScrollPane(databaseDetailsTable); // panel in the upper-right corner, holding the database table & buttons to load class assignment JPanel databaseDetailsPanel = UiUtils.makeBorderedPanel(new GridBagLayout(), "Database Details"); GridBagConstraintsIFS gcDatabaseDetails = new GridBagConstraintsIFS(GridBagConstraints.CENTER, GridBagConstraints.BOTH); gcDatabaseDetails.setWeights(1, 1); databaseDetailsPanel.add(scrollPaneDatabaseDetails, gcDatabaseDetails); initButtonLoadClassInfo(); databaseDetailsPanel.add(buttonLoadClassInfo, gc.nextRow()); JPanel histogramPanel = UiUtils.makeBorderedPanel("Histogram of Distances"); histogramPanel.add(chartPanel); JPanel detailsPanel = new JPanel(new VerticalLayout()); gcMain.setGridHeight(3); gcMain.setWeights(1, 1); getContentPane().add(detailsPanel, gcMain.moveTo(1, 0)); detailsPanel.add(databaseDetailsPanel); detailsPanel.add(histogramPanel); }
From source file:lu.lippmann.cdb.ext.hydviga.data.StationsDataProvider.java
public ChartPanel getMapPanel(final Collection<String> sel, final Collection<String> usable, final boolean withLegend) { final ChartPanel cp = buildMapPanel(getDataSetForMap(sel, usable), 1, 2, withLegend); //cp.setPreferredSize(new Dimension(200,320)); cp.setPreferredSize(new Dimension(225, 300)); cp.setMinimumSize(new Dimension(225, 300)); //cp.setMinimumSize(new Dimension(250,400)); cp.setBorder(new TitledBorder("")); return cp;/*from w ww . j a v a 2s .c o m*/ }
From source file:edu.clemson.cs.nestbed.client.gui.MoteDetailFrame.java
private JPanel buildMotePanel() { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder("Mote Information")); panel.setLayout(new BorderLayout()); panel.add(buildMoteLabelPanel(), BorderLayout.WEST); panel.add(buildMoteFieldPanel(), BorderLayout.CENTER); return panel; }