use of java.awt.FlowLayout in project jdk8u_jdk by JetBrains.
the class SampleTree method constructOptionsPanel.
/** Constructs a JPanel containing check boxes for the different
* options that tree supports. */
@SuppressWarnings("serial")
private JPanel constructOptionsPanel() {
JCheckBox aCheckbox;
JPanel retPanel = new JPanel(false);
JPanel borderPane = new JPanel(false);
borderPane.setLayout(new BorderLayout());
retPanel.setLayout(new FlowLayout());
aCheckbox = new JCheckBox("show top level handles");
aCheckbox.setSelected(tree.getShowsRootHandles());
aCheckbox.addChangeListener(new ShowHandlesChangeListener());
retPanel.add(aCheckbox);
aCheckbox = new JCheckBox("show root");
aCheckbox.setSelected(tree.isRootVisible());
aCheckbox.addChangeListener(new ShowRootChangeListener());
retPanel.add(aCheckbox);
aCheckbox = new JCheckBox("editable");
aCheckbox.setSelected(tree.isEditable());
aCheckbox.addChangeListener(new TreeEditableChangeListener());
aCheckbox.setToolTipText("Triple click to edit");
retPanel.add(aCheckbox);
borderPane.add(retPanel, BorderLayout.CENTER);
/* Create a set of radio buttons that dictate what selection should
be allowed in the tree. */
ButtonGroup group = new ButtonGroup();
JPanel buttonPane = new JPanel(false);
JRadioButton button;
buttonPane.setLayout(new FlowLayout());
buttonPane.setBorder(new TitledBorder("Selection Mode"));
button = new JRadioButton("Single");
button.addActionListener(new AbstractAction() {
@Override
public boolean isEnabled() {
return true;
}
public void actionPerformed(ActionEvent e) {
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
}
});
group.add(button);
buttonPane.add(button);
button = new JRadioButton("Contiguous");
button.addActionListener(new AbstractAction() {
@Override
public boolean isEnabled() {
return true;
}
public void actionPerformed(ActionEvent e) {
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
}
});
group.add(button);
buttonPane.add(button);
button = new JRadioButton("Discontiguous");
button.addActionListener(new AbstractAction() {
@Override
public boolean isEnabled() {
return true;
}
public void actionPerformed(ActionEvent e) {
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
}
});
button.setSelected(true);
group.add(button);
buttonPane.add(button);
borderPane.add(buttonPane, BorderLayout.SOUTH);
/*
JPanel clickPanel = new JPanel();
Object[] values = { "Never", new Integer(1),
new Integer(2), new Integer(3) };
final JComboBox clickCBox = new JComboBox(values);
clickPanel.setLayout(new FlowLayout());
clickPanel.add(new JLabel("Click count to expand:"));
clickCBox.setSelectedIndex(2);
clickCBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
Object selItem = clickCBox.getSelectedItem();
if(selItem instanceof Integer)
tree.setToggleClickCount(((Integer)selItem).intValue());
else // Don't toggle
tree.setToggleClickCount(0);
}
});
clickPanel.add(clickCBox);
borderPane.add(clickPanel, BorderLayout.NORTH);
*/
return borderPane;
}
use of java.awt.FlowLayout in project jdk8u_jdk by JetBrains.
the class SwingApplet method initUI.
private void initUI() {
// Trying to set Nimbus look and feel
try {
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception ex) {
Logger.getLogger(SwingApplet.class.getName()).log(Level.SEVERE, "Failed to apply Nimbus look and feel", ex);
}
getContentPane().setLayout(new FlowLayout());
button = new JButton("Hello, I'm a Swing Button!");
getContentPane().add(button);
getContentPane().doLayout();
}
use of java.awt.FlowLayout in project jdk8u_jdk by JetBrains.
the class ServiceDialog method initPageDialog.
/**
* Initialize "page setup" dialog
*/
void initPageDialog(int x, int y, PrintService ps, DocFlavor flavor, PrintRequestAttributeSet attributes) {
this.psCurrent = ps;
this.docFlavor = flavor;
this.asOriginal = attributes;
this.asCurrent = new HashPrintRequestAttributeSet(attributes);
if (attributes.get(DialogOnTop.class) != null) {
setAlwaysOnTop(true);
}
Container c = getContentPane();
c.setLayout(new BorderLayout());
pnlPageSetup = new PageSetupPanel();
c.add(pnlPageSetup, BorderLayout.CENTER);
pnlPageSetup.updateInfo();
JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
btnApprove = createExitButton("button.ok", this);
pnlSouth.add(btnApprove);
getRootPane().setDefaultButton(btnApprove);
btnCancel = createExitButton("button.cancel", this);
handleEscKey(btnCancel);
pnlSouth.add(btnCancel);
c.add(pnlSouth, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
dispose(CANCEL);
}
});
getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle"));
setResizable(false);
setLocation(x, y);
pack();
}
use of java.awt.FlowLayout in project jdk8u_jdk by JetBrains.
the class ServiceDialog method initPrintDialog.
/**
* Initialize print dialog.
*/
void initPrintDialog(int x, int y, PrintService[] services, int defaultServiceIndex, DocFlavor flavor, PrintRequestAttributeSet attributes) {
this.services = services;
this.defaultServiceIndex = defaultServiceIndex;
this.asOriginal = attributes;
this.asCurrent = new HashPrintRequestAttributeSet(attributes);
this.psCurrent = services[defaultServiceIndex];
this.docFlavor = flavor;
SunPageSelection pages = (SunPageSelection) attributes.get(SunPageSelection.class);
if (pages != null) {
isAWT = true;
}
if (attributes.get(DialogOnTop.class) != null) {
setAlwaysOnTop(true);
}
Container c = getContentPane();
c.setLayout(new BorderLayout());
tpTabs = new JTabbedPane();
tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));
String gkey = getMsg("tab.general");
int gmnemonic = getVKMnemonic("tab.general");
pnlGeneral = new GeneralPanel();
tpTabs.add(gkey, pnlGeneral);
tpTabs.setMnemonicAt(0, gmnemonic);
String pkey = getMsg("tab.pagesetup");
int pmnemonic = getVKMnemonic("tab.pagesetup");
pnlPageSetup = new PageSetupPanel();
tpTabs.add(pkey, pnlPageSetup);
tpTabs.setMnemonicAt(1, pmnemonic);
String akey = getMsg("tab.appearance");
int amnemonic = getVKMnemonic("tab.appearance");
pnlAppearance = new AppearancePanel();
tpTabs.add(akey, pnlAppearance);
tpTabs.setMnemonicAt(2, amnemonic);
c.add(tpTabs, BorderLayout.CENTER);
updatePanels();
JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
btnApprove = createExitButton("button.print", this);
pnlSouth.add(btnApprove);
getRootPane().setDefaultButton(btnApprove);
btnCancel = createExitButton("button.cancel", this);
handleEscKey(btnCancel);
pnlSouth.add(btnCancel);
c.add(pnlSouth, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
dispose(CANCEL);
}
});
getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
setResizable(false);
setLocation(x, y);
pack();
}
use of java.awt.FlowLayout in project JMRI by JMRI.
the class LocoDataPane method initComponents.
@Override
public void initComponents(jmri.jmrix.tams.TamsSystemConnectionMemo memo) {
super.initComponents(memo);
locoModel = new LocoDataModel(128, 16, memo);
locoTable = new JTable(locoModel);
locoTable.setRowSorter(new TableRowSorter<>(locoModel));
locoScroll = new JScrollPane(locoTable);
locoModel.configureTable(locoTable);
// general GUI config
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
// install items in GUI
JPanel pane1 = new JPanel();
pane1.setLayout(new FlowLayout());
pane1.add(new JLabel(rb.getString("Address")));
pane1.add(addr);
pane1.add(new JLabel(rb.getString("Name")));
pane1.add(name);
pane1.add(new JLabel(rb.getString("Steps")));
pane1.add(speedBox);
pane1.add(new JLabel(rb.getString("Format")));
pane1.add(formatBox);
pane1.add(addButton);
// add listener object so checkboxes function
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addLoco();
}
});
add(pane1);
add(locoScroll);
if (pane1.getMaximumSize().height > 0 && pane1.getMaximumSize().width > 0) {
pane1.setMaximumSize(pane1.getPreferredSize());
}
}
Aggregations