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 languagetool by languagetool-org.
the class LanguageManagerDialog method show.
public void show() {
dialog = new JDialog(owner, true);
dialog.setTitle(messages.getString("guiLanguageManagerDialog"));
// close dialog when user presses Escape key:
// TODO: taken from ConfigurationDialog, avoid duplication:
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
ActionListener actionListener = new ActionListener() {
@Override
@SuppressWarnings("unused")
public void actionPerformed(ActionEvent actionEvent) {
dialog.setVisible(false);
}
};
JRootPane rootPane = dialog.getRootPane();
rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new GridBagLayout());
list = new JList<>(ruleFiles.toArray(new File[ruleFiles.size()]));
GridBagConstraints cons = new GridBagConstraints();
cons.insets = new Insets(4, 4, 4, 4);
cons.gridx = 0;
cons.gridy = 0;
cons.fill = GridBagConstraints.BOTH;
cons.weightx = 2.0f;
cons.weighty = 2.0f;
contentPane.add(new JScrollPane(list), cons);
cons = new GridBagConstraints();
cons.insets = new Insets(4, 4, 4, 4);
cons.fill = GridBagConstraints.HORIZONTAL;
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridBagLayout());
addButton = new JButton(messages.getString("guiAddButton"));
addButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 0;
buttonPanel.add(addButton, cons);
removeButton = new JButton(messages.getString("guiRemoveButton"));
removeButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 1;
buttonPanel.add(removeButton, cons);
closeButton = new JButton(messages.getString("guiCloseButton"));
closeButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 2;
buttonPanel.add(closeButton, cons);
cons.gridx = 1;
cons.gridy = 0;
cons = new GridBagConstraints();
cons.anchor = GridBagConstraints.NORTH;
contentPane.add(buttonPanel, cons);
dialog.pack();
dialog.setSize(300, 200);
dialog.setLocationByPlatform(true);
dialog.setVisible(true);
}
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");
}
use of java.awt.GridBagLayout in project OpenNotebook by jaltekruse.
the class OpenNotebook method addContents.
private void addContents(Container c) {
notebookPanel = new NotebookPanel(this);
// propertiesFrames = new ObjectPropertiesFrame[MathObject.objects.length];
// for (int i = 0; i < MathObject.objects.length; i++){
// //System.out.println("before:" + (new java.util.Date().getTime() - timeAtStart));
// //propertiesFrames[i] = new ObjectPropertiesFrame(MathObject.objects[i], notebookPanel);
// //System.out.println("after:" + (new java.util.Date().getTime() - timeAtStart));
// }
new ObjectPropertiesFrame(new GraphObject(), notebookPanel);
new ObjectPropertiesFrame(new ExpressionObject(), notebookPanel);
c.removeAll();
c.setLayout(new GridBagLayout());
GridBagConstraints bCon = new GridBagConstraints();
bCon.fill = GridBagConstraints.BOTH;
bCon.weightx = 1;
bCon.weighty = 1;
c.add(notebookPanel, bCon);
}
use of java.awt.GridBagLayout in project OpenNotebook by jaltekruse.
the class ProblemListPanel method createPanelForProblems.
public JPanel createPanelForProblems() {
ProblemList panel = new ProblemList();
JPanel tempPanel;
GridBagConstraints con = new GridBagConstraints();
JComboBox frequencyChoices;
Component[] othersInRow = new Component[2];
;
int numProblemsToShow = notebookPanel.getDatabase().getAllProblems().size();
if (numProblemsToShow > 20) {
// limit the number of problems in the list
// to 20 at a time
numProblemsToShow = 20;
}
con.gridy = 0;
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.setLayout(new GridBagLayout());
for (final ProblemGenerator g : notebookPanel.getDatabase().getAllProblems()) {
// add checkbox
con.fill = GridBagConstraints.NONE;
con.gridx = 0;
con.gridwidth = 1;
con.weightx = 0;
con.insets = new Insets(0, 0, 0, 0);
final JCheckBox checkbox = new JCheckBox();
checkbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent ev) {
if (ev.getStateChange() == ItemEvent.SELECTED) {
selectedFrequencies.add(10);
selectedProblems.add(g);
} else {
selectedFrequencies.remove(selectedProblems.indexOf(g));
selectedProblems.remove(g);
}
previewPanel.getDoc().getPage(0).removeAllObjects();
// set the page size big to prevent problem generation from spawning pages
previewPanel.getDoc().setHeight(5000);
previewPanel.getDoc().setWidth(5000);
previewPanel.getDoc().generateProblem(g);
previewPanel.resizeViewWindow();
MathObject mObj = previewPanel.getDoc().getPage(0).getObjects().get(0);
previewPanel.getDoc().setWidth(mObj.getWidth() + 2 * problemBuffer);
previewPanel.getDoc().setHeight(mObj.getHeight() + 2 * problemBuffer);
mObj.setxPos(problemBuffer);
mObj.setyPos(problemBuffer);
previewPanel.resizeViewWindow();
}
});
frequencyChoices = new JComboBox(frequencies);
panel.add(checkbox, con);
othersInRow[0] = checkbox;
othersInRow[1] = frequencyChoices;
con.fill = GridBagConstraints.HORIZONTAL;
con.insets = new Insets(0, 5, 0, 0);
con.weightx = 1;
con.gridx = 1;
tempPanel = new ProblemDescriptionPanel(g, othersInRow);
tempPanel.addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent arg0) {
}
public void mouseEntered(MouseEvent arg0) {
}
public void mouseExited(MouseEvent arg0) {
}
@Override
public void mousePressed(MouseEvent arg0) {
checkbox.setSelected(!checkbox.isSelected());
}
public void mouseReleased(MouseEvent arg0) {
}
});
panel.add(tempPanel, con);
// // add frequency selection menu
// con.fill = GridBagConstraints.NONE;
// con.gridx = 2;
// con.weightx = 0;
// con.insets = new Insets(0, 5, 0, 5);
// frequencyChoices.setSelectedItem(AVERAGE);
// panel.add(frequencyChoices, con);
con.gridy++;
con.gridx = 0;
con.gridwidth = 2;
con.insets = new Insets(0, 0, 0, 0);
panel.add(new JSeparator(), con);
con.gridy++;
}
return panel;
}
Aggregations