use of javax.swing.BoxLayout in project adempiere by adempiere.
the class PreviewPanel method setupPreview.
/**
* Create the preview UI components
*/
private void setupPreview() {
JRootPane rootPane = new JRootPane();
previewPanel.setLayout(new BorderLayout());
previewPanel.add(rootPane, BorderLayout.CENTER);
previewPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
GridLayout gridLayout = new GridLayout(1, 3);
gridLayout.setHgap(4);
rootPane.getContentPane().setLayout(gridLayout);
rootPane.setGlassPane(new GlassPane());
rootPane.getGlassPane().setVisible(true);
CPanel column1 = new CPanel();
rootPane.getContentPane().add(column1);
CPanel column2 = new CPanel();
rootPane.getContentPane().add(column2);
CPanel column3 = new CPanel();
rootPane.getContentPane().add(column3);
column1.setLayout(new GridBagLayout());
JTree jtree = new JTree();
jtree.setFocusable(false);
jtree.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
column1.add(jtree, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 2), 0, 0));
CTextField normal = new CTextField("Text Field");
normal.setFocusable(false);
column1.add(normal, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 5, 2), 0, 0));
error.setBackground(true);
error.setFocusable(false);
column1.add(error, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column2.setLayout(new GridBagLayout());
JTable jtable = new JTable(s_data, s_columns);
JScrollPane scrollPane = new JScrollPane(jtable);
jtable.setFocusable(false);
scrollPane.setPreferredSize(jtable.getPreferredSize());
column2.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 2), 0, 0));
mandatory.setMandatory(true);
mandatory.setFocusable(false);
column2.add(mandatory, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CTextField inactive = new CTextField(s_res.getString("Inactive"));
inactive.setEnabled(false);
column2.add(inactive, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column3.setLayout(new GridBagLayout());
CTabbedPane tab = new CTabbedPane();
column3.add(tab, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 5), 0, 0));
CComboBox editable = new CComboBox(new Object[] { "Editable" });
editable.setEditable(true);
editable.setFocusable(false);
column3.add(editable, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CComboBox choice = new CComboBox(new Object[] { "Choice" });
choice.setEditable(false);
choice.setFocusable(false);
column3.add(choice, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 5), 0, 0));
tabPage1.setLayout(new BoxLayout(tabPage1, BoxLayout.Y_AXIS));
JRadioButton radio = new JRadioButton("Radio");
radio.setSelected(true);
radio.setMargin(new Insets(5, 5, 5, 5));
radio.setFocusable(false);
radio.setOpaque(false);
tabPage1.add(radio);
CCheckBox checkBox = new CCheckBox("Checkbox");
checkBox.setSelected(true);
checkBox.setMargin(new Insets(5, 5, 5, 5));
checkBox.setFocusable(false);
tabPage1.add(checkBox);
CLabel label = new CLabel("Label");
label.setHorizontalAlignment(JLabel.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
tabPage1.add(label);
button.setMargin(new Insets(5, 5, 5, 5));
button.setFocusable(false);
tabPage1.add(button);
tab.add(tabPage1, "tab1");
tab.add(new CPanel(), "tab2");
}
use of javax.swing.BoxLayout in project adempiere by adempiere.
the class ViewPI method initPanel.
/**
* Init Panel
*/
private void initPanel() {
BoxLayout layout = new BoxLayout(this, BoxLayout.PAGE_AXIS);
MGoal[] goals = MGoal.getGoals(Env.getCtx());
for (int i = 0; i < goals.length; i++) {
PerformanceIndicator pi = new PerformanceIndicator(goals[i]);
pi.addActionListener(this);
add(pi);
}
}
use of javax.swing.BoxLayout in project aerospike-client-java by aerospike.
the class GuiDisplay method initialize.
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frmAerospikeExamples = new JFrame();
frmAerospikeExamples.setTitle("Aerospike Java Client Examples");
frmAerospikeExamples.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmAerospikeExamples.pack();
frmAerospikeExamples.getContentPane().setLayout(new BorderLayout(0, 0));
splitPane = new JSplitPane();
splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
frmAerospikeExamples.getContentPane().add(splitPane, BorderLayout.CENTER);
mainPanel = new JPanel();
splitPane.setLeftComponent(mainPanel);
mainPanel.setLayout(new BorderLayout(0, 0));
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
runButton = new JButton("Run");
runButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent ev) {
consoleTextArea.setText("");
run_selected_examples();
}
});
buttonPanel.add(runButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
exitButton = new JButton("Quit");
exitButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
Container Frame = exitButton.getParent();
do {
Frame = Frame.getParent();
} while (!(Frame instanceof JFrame));
((JFrame) Frame).dispose();
}
});
buttonPanel.add(exitButton);
sourceTextPane = new JTextArea();
sourceTextPane.setTabSize(2);
sourceTextPane.setEditable(false);
scrollPane = new JScrollPane(sourceTextPane);
scrollPane.setViewportBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
scrollPane.setPreferredSize(new Dimension(600, 100));
mainPanel.add(scrollPane, BorderLayout.CENTER);
connectionPanel = new JPanel();
connectionPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
lblServerHost = new JLabel("Server Host");
connectionPanel.add(lblServerHost);
seedHostTextField = new JTextField();
seedHostTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
params.host = seedHostTextField.getText();
}
});
connectionPanel.add(seedHostTextField);
seedHostTextField.setColumns(10);
lblPort = new JLabel("Port");
connectionPanel.add(lblPort);
portTextField = new JTextField();
portTextField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent arg0) {
String newValue = namespaceTextField.getText();
if (newValue != null && newValue != "") {
try {
params.port = Integer.parseInt(newValue);
} catch (NumberFormatException ne) {
//ne.printStackTrace();
}
}
}
});
connectionPanel.add(portTextField);
portTextField.setColumns(4);
lblusername = new JLabel("User");
connectionPanel.add(lblusername);
usernameTextField = new JTextField();
usernameTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
params.user = usernameTextField.getText();
}
});
connectionPanel.add(usernameTextField);
usernameTextField.setColumns(8);
lblpassword = new JLabel("Password");
connectionPanel.add(lblpassword);
passwordTextField = new JPasswordField();
passwordTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
params.user = new String(passwordTextField.getPassword());
}
});
connectionPanel.add(passwordTextField);
passwordTextField.setColumns(8);
lblnameSpace = new JLabel("Namespace");
connectionPanel.add(lblnameSpace);
namespaceTextField = new JTextField();
namespaceTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
params.namespace = namespaceTextField.getText();
}
});
connectionPanel.add(namespaceTextField);
namespaceTextField.setColumns(8);
lblSet = new JLabel("Set");
connectionPanel.add(lblSet);
txtSetTextfield = new JTextField();
txtSetTextfield.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
params.set = txtSetTextfield.getText();
}
});
connectionPanel.add(txtSetTextfield);
txtSetTextfield.setColumns(8);
mainPanel.add(connectionPanel, BorderLayout.NORTH);
examplePanel = new JPanel();
examplePanel.setLayout(new BoxLayout(examplePanel, BoxLayout.Y_AXIS));
exampleScrollPane = new JScrollPane(examplePanel);
mainPanel.add(exampleScrollPane, BorderLayout.WEST);
// init values
seedHostTextField.setText(params.host);
portTextField.setText(Integer.toString(params.port));
namespaceTextField.setText(params.namespace);
txtSetTextfield.setText(params.set);
//int width = 785;
int width = 1000;
int height = 180;
consoleTextArea = new JTextArea();
consoleTextArea.setSize(new Dimension(width, height));
consoleTextArea.setEditable(false);
consoleScrollPane = new JScrollPane(consoleTextArea);
consoleScrollPane.setPreferredSize(new Dimension(width, height));
consoleScrollPane.setSize(new Dimension(width, height));
splitPane.setRightComponent(consoleScrollPane);
buttonGroup = new ButtonGroup();
JRadioButton jrb;
for (String example : Main.getAllExampleNames()) {
jrb = new JRadioButton(example);
jrb.setActionCommand(example);
jrb.addActionListener(this);
buttonGroup.add(jrb);
examplePanel.add(jrb);
}
frmAerospikeExamples.pack();
}
use of javax.swing.BoxLayout in project jmeter by apache.
the class StatGraphVisualizer method init.
/**
* Main visualizer setup.
*/
private void init() {
// WARNING: called from ctor so must not be overridden (i.e. must be private or final)
this.setLayout(new BorderLayout());
// MAIN PANEL
JPanel mainPanel = new JPanel();
Border margin = new EmptyBorder(10, 10, 5, 10);
Border margin2 = new EmptyBorder(10, 10, 5, 10);
mainPanel.setBorder(margin);
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
mainPanel.add(makeTitlePanel());
myJTable = new JTable(model);
myJTable.setRowSorter(new ObjectTableSorter(model).fixLastRow());
JMeterUtils.applyHiDPI(myJTable);
// Fix centering of titles
HeaderAsPropertyRendererWrapper.setupDefaultRenderer(myJTable, getColumnsMsgParameters());
myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
RendererUtils.applyRenderers(myJTable, getRenderers());
myScrollPane = new JScrollPane(myJTable);
settingsPane = new VerticalPanel();
settingsPane.setBorder(margin2);
graphPanel = new AxisGraph();
graphPanel.setPreferredSize(new Dimension(defaultWidth, defaultHeight));
settingsPane.add(createGraphActionsPane());
settingsPane.add(createGraphColumnPane());
settingsPane.add(createGraphTitlePane());
settingsPane.add(createGraphDimensionPane());
JPanel axisPane = new JPanel(new BorderLayout());
axisPane.add(createGraphXAxisPane(), BorderLayout.WEST);
axisPane.add(createGraphYAxisPane(), BorderLayout.CENTER);
settingsPane.add(axisPane);
settingsPane.add(createLegendPane());
//$NON-NLS-1$
tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane);
//$NON-NLS-1$
tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel);
// If clic on the Graph tab, make the graph (without apply interval or filter)
tabbedGraph.addChangeListener(changeEvent -> {
JTabbedPane srcTab = (JTabbedPane) changeEvent.getSource();
int index = srcTab.getSelectedIndex();
if (srcTab.getTitleAt(index).equals(JMeterUtils.getResString("aggregate_graph_tab_graph"))) {
actionMakeGraph();
}
});
spane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
spane.setOneTouchExpandable(true);
spane.setLeftComponent(myScrollPane);
spane.setRightComponent(tabbedGraph);
spane.setResizeWeight(.2);
// see bug jdk 4131528
spane.setBorder(null);
spane.setContinuousLayout(true);
this.add(mainPanel, BorderLayout.NORTH);
this.add(spane, BorderLayout.CENTER);
new Timer(REFRESH_PERIOD, e -> {
synchronized (lock) {
while (!newRows.isEmpty()) {
model.insertRow(newRows.pop(), model.getRowCount() - 1);
}
}
model.fireTableDataChanged();
}).start();
}
use of javax.swing.BoxLayout in project jmeter by apache.
the class StatGraphVisualizer method createGraphSelectionSubPane.
private JPanel createGraphSelectionSubPane() {
// Search field
JPanel searchPanel = new JPanel();
searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS));
searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
searchPanel.add(columnSelection);
columnMatchLabel.setEnabled(false);
applyFilterBtn.setEnabled(false);
caseChkBox.setEnabled(false);
regexpChkBox.setEnabled(false);
columnSelection.addActionListener(this);
searchPanel.add(columnMatchLabel);
searchPanel.add(Box.createRigidArea(new Dimension(5, 0)));
// Button
applyFilterBtn.setFont(FONT_SMALL);
applyFilterBtn.addActionListener(this);
searchPanel.add(applyFilterBtn);
// checkboxes
caseChkBox.setFont(FONT_SMALL);
searchPanel.add(caseChkBox);
regexpChkBox.setFont(FONT_SMALL);
searchPanel.add(regexpChkBox);
return searchPanel;
}
Aggregations