List of usage examples for com.jgoodies.forms.builder PanelBuilder addLabel
public final JLabel addLabel(String textWithMnemonic)
addLabel("Name:"); // No Mnemonic addLabel("N&ame:"); // Mnemonic is 'a' addLabel("Save &as:"); // Mnemonic is the second 'a' addLabel("Look&&Feel:"); // No mnemonic, text is "look&feel" From source file:de.htwk_leipzig.naoteam.motion.editor.gui.action.ActionCreateCalcKeyFrame.java
License:Open Source License
private void createUI(final NaoFrame[] frames, final int srcPos, final int toPos) { final JDialog dialog = new JDialog(app.getMainWindow(), "Select Frame", true); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); final JSlider slider = new JSlider(0, frames.length - 1); slider.setValue(0);/*from w w w . java 2s . c o m*/ slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { try { comm.playFrame(frames[slider.getValue()]); } catch (Exception e1) { e1.printStackTrace(); } } }); final JButton btnOk = new JButton("Ok"); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { app.getFrameList().add(toPos, frames[slider.getValue()]); dialog.setVisible(false); dialog.dispose(); } }); final JButton btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); } }); FormLayout layout = new FormLayout("left:pref, $lcgap, fill:640px:grow", "pref, $lgap, pref"); PanelBuilder builder = new PanelBuilder(layout /*, new FormDebugPanel() */); builder.addLabel("Frame:"); builder.nextColumn(2); builder.add(slider); builder.nextRow(2); builder.add(ButtonBarFactory.buildOKCancelBar(btnOk, btnCancel)); builder.setDefaultDialogBorder(); dialog.add(builder.getPanel()); dialog.pack(); final Dimension paneSize = dialog.getSize(); final Dimension screenSize = dialog.getToolkit().getScreenSize(); dialog.setLocation((screenSize.width - paneSize.width) / 2, (int) ((screenSize.height - paneSize.height) * 0.45)); dialog.setVisible(true); }
From source file:de.tntinteractive.portalsammler.gui.GetPasswordDialog.java
License:Open Source License
public GetPasswordDialog(final String storeIdentifier) { this.setTitle("Passwortprfung"); this.setModal(true); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.webcam = Webcam.getDefault(); final JComponent webcamPanel; if (this.webcam != null) { webcamPanel = new WebcamPanel(this.webcam); this.timer = new Timer(200, new ActionListener() { @Override//from w w w .j a va2 s . c o m public void actionPerformed(final ActionEvent e) { GetPasswordDialog.this.tryScan(); } }); this.timer.start(); } else { webcamPanel = new JLabel("Keine Webcam gefunden!"); } final PanelBuilder fields = new PanelBuilder(new FormLayout("p, 4dlu, fill:p:grow", "p")); fields.addLabel("&Passwort fr " + storeIdentifier); this.passwordField = new JPasswordField(); fields.add(this.passwordField, CC.xy(3, 1)); final ButtonBarBuilder bbb = new ButtonBarBuilder(); bbb.addGlue(); final JButton okButton = this.createOkButton(); bbb.addButton(okButton, this.createCancelButton()); this.getRootPane().setDefaultButton(okButton); final PanelBuilder panelBuilder = new PanelBuilder( new FormLayout("4dlu, fill:p:grow, 4dlu", "4dlu, p, 4dlu, p, 4dlu, p, 4dlu")); panelBuilder.add(fields.build(), CC.xy(2, 2)); panelBuilder.add(webcamPanel, CC.xy(2, 4)); panelBuilder.add(bbb.build(), CC.xy(2, 6)); this.setContentPane(panelBuilder.getPanel()); this.pack(); this.setLocationRelativeTo(this.getOwner()); }
From source file:edu.udo.scaffoldhunter.gui.dataimport.ImportDialog.java
License:Open Source License
private JPanel buildDatasetNamePanel() { PanelBuilder builder = new PanelBuilder( new FormLayout("p,3dlu, p:g(0.5),10dlu,p,3dlu,p:g(1.0)", "max(p;60dlu)")); builder.addLabel(_("DataImport.DatasetName")); builder.nextColumn(2);/*from w w w . ja va2 s . c o m*/ datasetName = new JTextField(); datasetName.setDocument(importProcess.getDatasetNameDocument()); datasetName.getDocument().addDocumentListener(this); datasetName.setColumns(20); SelectAllOnFocus.addTo(datasetName); builder.add(datasetName); builder.nextColumn(2); builder.addLabel(_("DataImport.DatasetDescription")); builder.nextColumn(2); datasetDescription = new JTextArea(importProcess.getDatasetDescriptionDocument()); datasetDescription.setLineWrap(true); /* * set preferredSize und minimumSize explicitly. Otherwise the textarea * will grow but won't shrink again as the preferred size would have * grown */ JScrollPane p = new JScrollPane(datasetDescription); p.setMinimumSize(p.getMinimumSize()); p.setPreferredSize(p.getPreferredSize()); builder.add(p, CC.xy(7, 1, "f, f")); return builder.getPanel(); }
From source file:phex.gui.dialogs.security.SecurityRuleDialog.java
License:Open Source License
private JPanel createTimePanel() { JPanel timePanel = new JPanel(); FormLayout layout = new FormLayout("d, 1dlu, d, 3dlu, d, 1dlu, d, 3dlu, d, 1dlu, d", "p"); PanelBuilder panelBuilder = new PanelBuilder(layout, timePanel); panelBuilder.add(daysTF);//from w w w. j a va 2 s . c om panelBuilder.setColumn(3); daysLabel = panelBuilder.addLabel(Localizer.getString("SecurityRuleDialog_Days")); panelBuilder.setColumn(5); panelBuilder.add(hoursTF); panelBuilder.setColumn(7); hoursLabel = panelBuilder.addLabel(Localizer.getString("SecurityRuleDialog_Hours")); panelBuilder.setColumn(9); panelBuilder.add(minutesTF); panelBuilder.setColumn(11); minutesLabel = panelBuilder.addLabel(Localizer.getString("SecurityRuleDialog_Minutes")); return timePanel; }