use of javax.swing.JLabel 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 javax.swing.JLabel in project checkstyle by checkstyle.
the class MainFrame method createButtonsPanel.
/**
* Create buttons panel.
* @return buttons panel.
*/
private JPanel createButtonsPanel() {
final JButton openFileButton = new JButton(new FileSelectionAction());
openFileButton.setMnemonic(KeyEvent.VK_S);
openFileButton.setText("Open File");
reloadAction.setEnabled(false);
final JButton reloadFileButton = new JButton(reloadAction);
reloadFileButton.setMnemonic(KeyEvent.VK_R);
reloadFileButton.setText("Reload File");
final JComboBox<ParseMode> modesCombobox = new JComboBox<>(ParseMode.values());
modesCombobox.setSelectedIndex(0);
modesCombobox.addActionListener(e -> {
model.setParseMode((ParseMode) modesCombobox.getSelectedItem());
reloadAction.actionPerformed(null);
});
final JLabel modesLabel = new JLabel("Modes:", SwingConstants.RIGHT);
final int leftIndentation = 10;
modesLabel.setBorder(BorderFactory.createEmptyBorder(0, leftIndentation, 0, 0));
final JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1, 2));
buttonPanel.add(openFileButton);
buttonPanel.add(reloadFileButton);
final JPanel modesPanel = new JPanel();
modesPanel.add(modesLabel);
modesPanel.add(modesCombobox);
final JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
mainPanel.add(buttonPanel);
mainPanel.add(modesPanel, BorderLayout.LINE_END);
return mainPanel;
}
use of javax.swing.JLabel in project Fling by entertailion.
the class DragHereIcon method makeUI.
/**
* Display a custom icon with file drag-and-drop support
*
* @param flingFrame
* the parent frame
* @return
*/
public static JComponent makeUI(final FlingFrame flingFrame) {
JLabel label = new JLabel(new DragHereIcon());
label.setText("<html>Drag <b>Media</b> Here");
label.setVerticalTextPosition(SwingConstants.BOTTOM);
label.setHorizontalTextPosition(SwingConstants.CENTER);
label.setForeground(Color.GRAY);
label.setFont(new Font("Monospace", Font.PLAIN, 24));
JPanel p = new JPanel();
p.add(label);
p.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
new FileDrop(p, new FileDrop.Listener() {
public void filesDropped(java.io.File[] files) {
if (files != null && files.length > 0) {
try {
String file = files[0].getCanonicalPath();
Log.d(LOG_TAG, file);
Properties systemProperties = System.getProperties();
// EmbeddedServer.serveFile
systemProperties.setProperty(EmbeddedServer.CURRENT_FILE, file);
flingFrame.sendMediaUrl(file);
} catch (IOException e) {
}
}
}
});
// end FileDrop.Listener
return p;
}
use of javax.swing.JLabel 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 javax.swing.JLabel 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);
}
Aggregations