use of javax.swing.JButton in project nhin-d by DirectProject.
the class ComponentCreation method createBrowseFile.
/**
* Process the container pane to create file chooser or directory chooser swing component as per the identifier given as parameter
* @param type This decide which component should be created
* @param labelData This is the value of a component/or can be used as title of the component
* @param c is a object of GridBagConstarins, and used to set any grid layout
* @param pane Container object to add component into this pane
* @param gridx This is the x index integer value for the component inside the grid
* @param gridy This is the y index integer value for the component inside the grid
* @return void
*/
public void createBrowseFile(String type, String lableData, GridBagConstraints c, Container pane, int gridx, int gridy) {
JTextField filename = new JTextField();
filename.setText(lableData);
ComponentCreation ex = new ComponentCreation();
JButton open = new JButton("Browse");
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = gridx;
c.gridy = gridy;
pane.add(filename, c);
if (type.equalsIgnoreCase("FILE")) {
open.addActionListener(ex.new OpenL(filename));
}
if (type.equalsIgnoreCase("DIRECTORY")) {
open.addActionListener(ex.new OpenD(filename));
}
c.fill = GridBagConstraints.NONE;
c.gridx = gridx + 1;
c.gridy = gridy;
pane.add(open, c);
filename.setEditable(false);
}
use of javax.swing.JButton in project nhin-d by DirectProject.
the class ValidatePanel method initUI.
protected void initUI() {
setLayout(new BorderLayout());
setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
// File Load Fields
policyFileField = new FileField("Policy Definition File:", "");
certFileField = new FileField("Certificate File: ", "");
final JPanel filePanel = new JPanel(new GridLayout(1, 2));
filePanel.add(certFileField);
filePanel.add(policyFileField);
this.add(filePanel, BorderLayout.NORTH);
// Report panel
final JLabel reportHeaderLabel = new JLabel("Validation Report");
reportText = new JTextArea();
reportText.setLineWrap(true);
reportText.setWrapStyleWord(true);
reportText.setEditable(false);
final JScrollPane scrollPane = new JScrollPane(reportText);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
final JPanel reportPanel = new JPanel(new BorderLayout());
reportPanel.add(reportHeaderLabel, BorderLayout.NORTH);
reportPanel.add(scrollPane, BorderLayout.CENTER);
this.add(reportPanel, BorderLayout.CENTER);
// Button Panel
cmdValidate = new JButton("Validate");
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.add(cmdValidate);
this.add(buttonPanel, BorderLayout.SOUTH);
}
use of javax.swing.JButton in project jdk8u_jdk by JetBrains.
the class DimensionEncapsulation method run.
@Override
public void run() {
runTest(new Panel());
runTest(new Button());
runTest(new Checkbox());
runTest(new Canvas());
runTest(new Choice());
runTest(new Label());
runTest(new Scrollbar());
runTest(new TextArea());
runTest(new TextField());
runTest(new Dialog(new JFrame()));
runTest(new Frame());
runTest(new Window(new JFrame()));
runTest(new FileDialog(new JFrame()));
runTest(new List());
runTest(new ScrollPane());
runTest(new JFrame());
runTest(new JDialog(new JFrame()));
runTest(new JWindow(new JFrame()));
runTest(new JLabel("hi"));
runTest(new JMenu());
runTest(new JTree());
runTest(new JTable());
runTest(new JMenuItem());
runTest(new JCheckBoxMenuItem());
runTest(new JToggleButton());
runTest(new JSpinner());
runTest(new JSlider());
runTest(Box.createVerticalBox());
runTest(Box.createHorizontalBox());
runTest(new JTextField());
runTest(new JTextArea());
runTest(new JTextPane());
runTest(new JPasswordField());
runTest(new JFormattedTextField());
runTest(new JEditorPane());
runTest(new JButton());
runTest(new JColorChooser());
runTest(new JFileChooser());
runTest(new JCheckBox());
runTest(new JInternalFrame());
runTest(new JDesktopPane());
runTest(new JTableHeader());
runTest(new JLayeredPane());
runTest(new JRootPane());
runTest(new JMenuBar());
runTest(new JOptionPane());
runTest(new JRadioButton());
runTest(new JRadioButtonMenuItem());
runTest(new JPopupMenu());
//runTest(new JScrollBar()); --> don't test defines max and min in
// terms of preferred
runTest(new JScrollPane());
runTest(new JViewport());
runTest(new JSplitPane());
runTest(new JTabbedPane());
runTest(new JToolBar());
runTest(new JSeparator());
runTest(new JProgressBar());
if (!failures.isEmpty()) {
System.out.println("These classes failed");
for (final Component failure : failures) {
System.out.println(failure.getClass());
}
throw new RuntimeException("Test failed");
}
}
use of javax.swing.JButton in project jdk8u_jdk by JetBrains.
the class FontScalingTest method getFontSize.
private static int getFontSize(String laf) throws Exception {
UIManager.setLookAndFeel(laf);
final int[] sizes = new int[1];
SwingUtilities.invokeAndWait(() -> {
JButton button = new JButton("Test");
sizes[0] = button.getFont().getSize();
});
return sizes[0];
}
use of javax.swing.JButton in project jdk8u_jdk by JetBrains.
the class Test4759934 method show.
private void show(Window window, String command) {
JButton button = new JButton(command);
button.setActionCommand(command);
button.addActionListener(this);
button.setFont(button.getFont().deriveFont(64.0f));
window.add(button);
window.pack();
window.setVisible(true);
}
Aggregations