use of java.awt.GridLayout in project java-design-patterns by iluwatar.
the class Client method setup.
private void setup() {
setLayout(new BorderLayout());
JPanel panel = new JPanel();
add(jl, BorderLayout.SOUTH);
add(panel, BorderLayout.CENTER);
panel.setLayout(new GridLayout(6, 2));
panel.add(new JLabel("Name"));
panel.add(jtFields[0]);
panel.add(new JLabel("Contact Number"));
panel.add(jtFields[1]);
panel.add(new JLabel("Address"));
panel.add(jtAreas[0]);
panel.add(new JLabel("Deposit Number"));
panel.add(jtFields[2]);
panel.add(new JLabel("Order"));
panel.add(jtAreas[1]);
panel.add(clearButton);
panel.add(processButton);
clearButton.addActionListener(e -> {
for (JTextArea i : jtAreas) {
i.setText("");
}
for (JTextField i : jtFields) {
i.setText("");
}
});
processButton.addActionListener(e -> {
Order order = new Order(jtFields[0].getText(), jtFields[1].getText(), jtAreas[0].getText(), jtFields[2].getText(), jtAreas[1].getText());
jl.setText(sendRequest(order));
});
JRootPane rootPane = SwingUtilities.getRootPane(processButton);
rootPane.setDefaultButton(processButton);
setVisible(true);
}
use of java.awt.GridLayout in project n2a by frothga.
the class Lay method GLtg.
public static JPanel GLtg(Container target, int rows, int cols, Object... args) {
HintList hints = new HintList();
List<Component> cmpsChosen = new ArrayList<Component>();
for (Object arg : args) {
// Add any hints
if (arg instanceof String) {
hints.addHints(parseHints((String) arg));
// Add components
} else if (arg instanceof Component) {
cmpsChosen.add((Component) arg);
}
// Else ignore
}
Container cont = chooseContainer(target, hints);
GridLayout gl = new GridLayout(rows, cols, 0, 0);
cont.setLayout(gl);
for (Component c : cmpsChosen) {
cont.add(c);
}
setHints(cont, hints);
return (target == null) ? (JPanel) cont : null;
}
use of java.awt.GridLayout in project cayenne by apache.
the class MultiColumnBrowser method adjustViewColumns.
/**
* Expands or contracts the view by <code>delta</code> columns. Never
* contracts the view below <code>minColumns</code>.
*/
private void adjustViewColumns(int delta) {
if (delta == 0) {
return;
}
setLayout(new GridLayout(1, columns.size() + delta, 3, 3));
if (delta > 0) {
for (int i = 0; i < delta; i++) {
appendColumn();
}
} else {
for (int i = -delta; i > 0 && columns.size() > minColumns; i--) {
removeLastColumn();
}
}
refreshPreferredSize();
revalidate();
}
use of java.awt.GridLayout in project knime-core by knime.
the class StringManipulationNodeDialog method createPanel.
/**
* @since 3.3
*/
protected JPanel createPanel() {
JPanel southPanel = new JPanel(new GridLayout(0, 2));
JPanel replaceOrAppend = createAndOrReplacePanel();
southPanel.add(replaceOrAppend);
JPanel returnTypeAndCompilation = createReturnTypeAndCompilationPanel();
southPanel.add(returnTypeAndCompilation);
JPanel p = new JPanel(new BorderLayout());
p.add(m_snippetPanel, BorderLayout.CENTER);
p.add(southPanel, BorderLayout.SOUTH);
p.setPreferredSize(new Dimension(820, 420));
return p;
}
use of java.awt.GridLayout in project knime-core by knime.
the class TimeMissingValueHandlingPanel method createWarningLabel.
private static Component createWarningLabel(final List<String> warningMessages) {
JPanel thin = new JPanel(new GridLayout(warningMessages.size(), 1));
for (int i = 0; i < warningMessages.size(); i++) {
String message = warningMessages.get(i);
thin.add(new JLabel(message));
}
return thin;
}
Aggregations