use of java.awt.GridBagLayout in project zookeeper by apache.
the class NodeViewerMetaData method nodeSelectionChanged.
/*
* (non-Javadoc)
*
* @see
* org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer#
* nodeSelectionChanged(java.util.Set)
*/
@Override
public void nodeSelectionChanged(List<String> selectedNodes) {
this.metaDataPanel.removeAll();
if (selectedNodes.size() > 0) {
this.selectedNode = selectedNodes.get(0);
SwingWorker<Map<String, String>, Void> worker = new SwingWorker<Map<String, String>, Void>() {
@Override
protected Map<String, String> doInBackground() throws Exception {
return NodeViewerMetaData.this.zooInspectorManager.getNodeMeta(NodeViewerMetaData.this.selectedNode);
}
@Override
protected void done() {
Map<String, String> data = null;
try {
data = get();
} catch (InterruptedException e) {
data = new HashMap<String, String>();
LoggerFactory.getLogger().error("Error retrieving meta data for node: " + NodeViewerMetaData.this.selectedNode, e);
} catch (ExecutionException e) {
data = new HashMap<String, String>();
LoggerFactory.getLogger().error("Error retrieving meta data for node: " + NodeViewerMetaData.this.selectedNode, e);
}
NodeViewerMetaData.this.metaDataPanel.setLayout(new GridBagLayout());
JPanel infoPanel = new JPanel();
infoPanel.setBackground(Color.WHITE);
infoPanel.setLayout(new GridBagLayout());
int i = 0;
int rowPos = 0;
for (Map.Entry<String, String> entry : data.entrySet()) {
rowPos = 2 * i + 1;
JLabel label = new JLabel(entry.getKey());
JTextField text = new JTextField(entry.getValue());
text.setEditable(false);
GridBagConstraints c1 = new GridBagConstraints();
c1.gridx = 0;
c1.gridy = rowPos;
c1.gridwidth = 1;
c1.gridheight = 1;
c1.weightx = 0;
c1.weighty = 0;
c1.anchor = GridBagConstraints.WEST;
c1.fill = GridBagConstraints.HORIZONTAL;
c1.insets = new Insets(5, 5, 5, 5);
c1.ipadx = 0;
c1.ipady = 0;
infoPanel.add(label, c1);
GridBagConstraints c2 = new GridBagConstraints();
c2.gridx = 2;
c2.gridy = rowPos;
c2.gridwidth = 1;
c2.gridheight = 1;
c2.weightx = 0;
c2.weighty = 0;
c2.anchor = GridBagConstraints.WEST;
c2.fill = GridBagConstraints.HORIZONTAL;
c2.insets = new Insets(5, 5, 5, 5);
c2.ipadx = 0;
c2.ipady = 0;
infoPanel.add(text, c2);
i++;
}
GridBagConstraints c = new GridBagConstraints();
c.gridx = 1;
c.gridy = rowPos;
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 1;
c.anchor = GridBagConstraints.NORTHWEST;
c.fill = GridBagConstraints.NONE;
c.insets = new Insets(5, 5, 5, 5);
c.ipadx = 0;
c.ipady = 0;
NodeViewerMetaData.this.metaDataPanel.add(infoPanel, c);
NodeViewerMetaData.this.metaDataPanel.revalidate();
NodeViewerMetaData.this.metaDataPanel.repaint();
}
};
worker.execute();
}
}
use of java.awt.GridBagLayout in project buck by facebook.
the class BuckSettingsUI method init.
private void init() {
setLayout(new BorderLayout());
JPanel container = this;
buckPathField = new TextFieldWithBrowseButton();
FileChooserDescriptor buckFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
buckPathField.addBrowseFolderListener("", "Buck Executable Path", null, buckFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
adbPathField = new TextFieldWithBrowseButton();
FileChooserDescriptor adbFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
adbPathField.addBrowseFolderListener("", "Adb Executable Path", null, adbFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
customizedInstallSettingField = new JBTextField();
customizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_FLAGS_HINT);
customizedInstallSettingField.setEnabled(false);
showDebug = new JCheckBox("Show debug in tool window");
enableAutoDeps = new JCheckBox("Enable auto dependencies");
runAfterInstall = new JCheckBox("Run after install (-r)");
multiInstallMode = new JCheckBox("Multi-install mode (-x)");
uninstallBeforeInstall = new JCheckBox("Uninstall before installing (-u)");
customizedInstallSetting = new JCheckBox("Use customized install setting: ");
initCustomizedInstallCommandListener();
JPanel buckSettings = new JPanel(new GridBagLayout());
buckSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Settings", true));
container.add(container = new JPanel(new BorderLayout()), BorderLayout.NORTH);
container.add(buckSettings, BorderLayout.NORTH);
final GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
buckSettings.add(new JLabel("Buck Executable Path:"), constraints);
constraints.gridx = 1;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
buckSettings.add(buckPathField, constraints);
constraints.gridx = 0;
constraints.gridy = 1;
constraints.weightx = 1;
buckSettings.add(new JLabel("Adb Executable Path:"), constraints);
constraints.gridx = 1;
constraints.gridy = 1;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
buckSettings.add(adbPathField, constraints);
constraints.gridx = 0;
constraints.gridy = 2;
buckSettings.add(showDebug, constraints);
constraints.gridx = 0;
constraints.gridy = 3;
buckSettings.add(enableAutoDeps, constraints);
JPanel installSettings = new JPanel(new BorderLayout());
installSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Install Settings", true));
container.add(container = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
container.add(installSettings, BorderLayout.NORTH);
installSettings.add(runAfterInstall, BorderLayout.NORTH);
installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
installSettings.add(multiInstallMode, BorderLayout.NORTH);
installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
installSettings.add(uninstallBeforeInstall, BorderLayout.NORTH);
installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
final GridBagConstraints customConstraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
JPanel customizedInstallSetting = new JPanel(new GridBagLayout());
customizedInstallSetting.add(this.customizedInstallSetting, customConstraints);
customConstraints.gridx = 1;
customConstraints.weightx = 1;
customConstraints.fill = GridBagConstraints.HORIZONTAL;
customizedInstallSetting.add(customizedInstallSettingField, customConstraints);
installSettings.add(customizedInstallSetting, BorderLayout.NORTH);
}
use of java.awt.GridBagLayout in project qi4j-sdk by Qi4j.
the class EntityViewer method $$$setupUI$$$.
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
*/
private void $$$setupUI$$$() {
mainPane = new JPanel();
mainPane.setLayout(new BorderLayout(0, 0));
splitPane = new JSplitPane();
mainPane.add(splitPane, BorderLayout.CENTER);
propertiesAreaPane = new JPanel();
propertiesAreaPane.setLayout(new BorderLayout(0, 0));
splitPane.setRightComponent(propertiesAreaPane);
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridBagLayout());
propertiesAreaPane.add(panel1, BorderLayout.NORTH);
entitiesCombo = new JComboBox();
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.gridwidth = 3;
gbc.weightx = 0.3;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel1.add(entitiesCombo, gbc);
final JLabel label1 = new JLabel();
label1.setText("Entity");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
panel1.add(label1, gbc);
final JPanel spacer1 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel1.add(spacer1, gbc);
}
use of java.awt.GridBagLayout in project qi4j-sdk by Qi4j.
the class DependencyPane method $$$setupUI$$$.
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
*/
private void $$$setupUI$$$() {
contentPane = new JPanel();
contentPane.setLayout(new BorderLayout(0, 0));
splitPane = new JSplitPane();
contentPane.add(splitPane, BorderLayout.CENTER);
final JScrollPane scrollPane1 = new JScrollPane();
splitPane.setLeftComponent(scrollPane1);
fieldList = new JList();
scrollPane1.setViewportView(fieldList);
detailPane = new JPanel();
detailPane.setLayout(new GridBagLayout());
splitPane.setRightComponent(detailPane);
detailPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8), null));
final JLabel label1 = new JLabel();
this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_ClassName.Text"));
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.EAST;
detailPane.add(label1, gbc);
final JPanel spacer1 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
detailPane.add(spacer1, gbc);
final JPanel spacer2 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.VERTICAL;
detailPane.add(spacer2, gbc);
final JLabel label2 = new JLabel();
this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_Optional.Text"));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.EAST;
detailPane.add(label2, gbc);
final JLabel label3 = new JLabel();
this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_Annotation.Text"));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 4;
gbc.anchor = GridBagConstraints.EAST;
detailPane.add(label3, gbc);
final JPanel spacer3 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 3;
gbc.fill = GridBagConstraints.VERTICAL;
detailPane.add(spacer3, gbc);
final JPanel spacer4 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 5;
gbc.fill = GridBagConstraints.VERTICAL;
detailPane.add(spacer4, gbc);
final JPanel spacer5 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 9;
gbc.fill = GridBagConstraints.VERTICAL;
detailPane.add(spacer5, gbc);
final JLabel label4 = new JLabel();
this.$$$loadLabelText$$$(label4, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_InjectionType.Text"));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 10;
gbc.anchor = GridBagConstraints.EAST;
detailPane.add(label4, gbc);
classNameLabel = new JLabel();
classNameLabel.setText("none");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.WEST;
detailPane.add(classNameLabel, gbc);
annotationLabel = new JLabel();
annotationLabel.setText("none");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 4;
gbc.anchor = GridBagConstraints.WEST;
detailPane.add(annotationLabel, gbc);
injectionTypeLabel = new JLabel();
injectionTypeLabel.setText("none");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 10;
gbc.anchor = GridBagConstraints.WEST;
detailPane.add(injectionTypeLabel, gbc);
optionalLabel = new JLabel();
optionalLabel.setText("none");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.WEST;
detailPane.add(optionalLabel, gbc);
final JPanel spacer6 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 7;
gbc.fill = GridBagConstraints.VERTICAL;
detailPane.add(spacer6, gbc);
final JLabel label5 = new JLabel();
this.$$$loadLabelText$$$(label5, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_Injection.Text"));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 8;
gbc.anchor = GridBagConstraints.WEST;
detailPane.add(label5, gbc);
final JScrollPane scrollPane2 = new JScrollPane();
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 12;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
detailPane.add(scrollPane2, gbc);
injectedServiceList = new JList();
scrollPane2.setViewportView(injectedServiceList);
final JPanel spacer7 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 11;
gbc.fill = GridBagConstraints.VERTICAL;
detailPane.add(spacer7, gbc);
final JLabel label6 = new JLabel();
this.$$$loadLabelText$$$(label6, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_InjectedServices.Text"));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 12;
gbc.anchor = GridBagConstraints.NORTHEAST;
detailPane.add(label6, gbc);
final JSeparator separator1 = new JSeparator();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 6;
gbc.gridwidth = 3;
gbc.fill = GridBagConstraints.BOTH;
detailPane.add(separator1, gbc);
}
use of java.awt.GridBagLayout in project Smack by igniterealtime.
the class EnhancedDebugger method addInformationPanel.
private void addInformationPanel() {
// Create UI elements for connection information.
JPanel informationPanel = new JPanel();
informationPanel.setLayout(new BorderLayout());
// Add the Host information
JPanel connPanel = new JPanel();
connPanel.setLayout(new GridBagLayout());
connPanel.setBorder(BorderFactory.createTitledBorder("XMPPConnection information"));
JLabel label = new JLabel("Host: ");
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
JFormattedTextField field = new JFormattedTextField(connection.getXMPPServiceDomain());
field.setMinimumSize(new java.awt.Dimension(150, 20));
field.setMaximumSize(new java.awt.Dimension(150, 20));
field.setEditable(false);
field.setBorder(null);
connPanel.add(field, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
// Add the Port information
label = new JLabel("Port: ");
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
field = new JFormattedTextField(connection.getPort());
field.setMinimumSize(new java.awt.Dimension(150, 20));
field.setMaximumSize(new java.awt.Dimension(150, 20));
field.setEditable(false);
field.setBorder(null);
connPanel.add(field, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
// Add the connection's User information
label = new JLabel("User: ");
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(label, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
userField = new JFormattedTextField();
userField.setMinimumSize(new java.awt.Dimension(150, 20));
userField.setMaximumSize(new java.awt.Dimension(150, 20));
userField.setEditable(false);
userField.setBorder(null);
connPanel.add(userField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
// Add the connection's creationTime information
label = new JLabel("Creation time: ");
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(label, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
field = new JFormattedTextField(new SimpleDateFormat("yyyy.MM.dd HH:mm:ss:SS"));
field.setMinimumSize(new java.awt.Dimension(150, 20));
field.setMaximumSize(new java.awt.Dimension(150, 20));
field.setValue(creationTime);
field.setEditable(false);
field.setBorder(null);
connPanel.add(field, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
// Add the connection's creationTime information
label = new JLabel("Status: ");
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(label, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
statusField = new JFormattedTextField();
statusField.setMinimumSize(new java.awt.Dimension(150, 20));
statusField.setMaximumSize(new java.awt.Dimension(150, 20));
statusField.setValue("Active");
statusField.setEditable(false);
statusField.setBorder(null);
connPanel.add(statusField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
// Add the connection panel to the information panel
informationPanel.add(connPanel, BorderLayout.NORTH);
// Add the Number of sent packets information
JPanel packetsPanel = new JPanel();
packetsPanel.setLayout(new GridLayout(1, 1));
packetsPanel.setBorder(BorderFactory.createTitledBorder("Transmitted Packets"));
statisticsTable = new DefaultTableModel(new Object[][] { { "IQ", 0, 0 }, { "Message", 0, 0 }, { "Presence", 0, 0 }, { "Other", 0, 0 }, { "Total", 0, 0 } }, new Object[] { "Type", "Received", "Sent" }) {
// CHECKSTYLE:OFF
private static final long serialVersionUID = -6793886085109589269L;
@Override
public boolean isCellEditable(int rowIndex, int mColIndex) {
// CHECKSTYLE:ON
return false;
}
};
JTable table = new JTable(statisticsTable);
// Allow only single a selection
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
packetsPanel.add(new JScrollPane(table));
// Add the packets panel to the information panel
informationPanel.add(packetsPanel, BorderLayout.CENTER);
tabbedPane.add("Information", new JScrollPane(informationPanel));
tabbedPane.setToolTipTextAt(4, "Information and statistics about the debugged connection");
}
Aggregations