下面列出了java.awt.GridBagConstraints#EAST 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public JPanel createConfigPanel(PalettePanel palettePanel) {
var p = new JPanel(new GridBagLayout());
satSlider = createSlider(saturation, "Saturation of the colors");
satSlider.addChangeListener(e -> onNewSat(palettePanel));
hueSlider = createSlider(hueShift, "Rotate the hue of the colors");
hueSlider.addChangeListener(e -> onNewHue(palettePanel));
Insets insets = new Insets(2, 4, 2, 4);
var labelCtr = new GridBagConstraints(0, 0, 1, 1, 0, 0,
GridBagConstraints.CENTER,
GridBagConstraints.NONE, insets, 0, 0);
var sliderCtr = new GridBagConstraints(1, 0, 1, 1, 1.0, 0,
GridBagConstraints.EAST,
GridBagConstraints.HORIZONTAL, insets, 0, 0);
p.add(new JLabel("Sat:"), labelCtr);
p.add(satSlider, sliderCtr);
labelCtr.gridy = 1;
p.add(new JLabel("Hue:"), labelCtr);
sliderCtr.gridy = 1;
p.add(hueSlider, sliderCtr);
return p;
}
/**
* Adds a row (line) with the two JComponents <code>label, secondC</code>
* to the given <code>panel</code>, using constraints c. The label will be
* right-aligned, the secondC left-aligned to bring them close together.
* Only useful for simple panels with GridBagLayout.
*/
protected void addOptionRow(JPanel targetP, GridBagConstraints c, JLabel label, Component secondC) {
int oldGridW = c.gridwidth;
int oldAnchor = c.anchor;
c.gridwidth = 1;
c.anchor = GridBagConstraints.EAST;
targetP.add(label, c);
c.gridwidth = GridBagConstraints.REMAINDER;
c.anchor = GridBagConstraints.WEST;
targetP.add(secondC, c);
c.gridwidth = oldGridW;
c.anchor = oldAnchor;
}
protected JPanel createLocationFieldPanel() {
final GridBagConstraints c = new GridBagConstraints();
final JPanel locationFieldPanel = new JPanel();
locationFieldPanel.setLayout( new GridBagLayout() );
c.insets = new Insets( 0, 5, 5, 0 );
c.gridx = 0;
c.gridy = 0;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
c.anchor = GridBagConstraints.WEST;
locationFieldPanel.add( getLocationCombo(), c );
c.insets = new Insets( 5, 8, 5, 0 );
c.gridx = 1;
c.gridy = 0;
c.fill = GridBagConstraints.NONE;
c.weightx = 0.0;
c.anchor = GridBagConstraints.WEST;
locationFieldPanel.add( new BorderlessButton( new LevelUpAction() ), c );
c.gridx = 2;
c.gridy = 0;
c.fill = GridBagConstraints.NONE;
c.weightx = 0.0;
c.anchor = GridBagConstraints.EAST;
locationFieldPanel.add( new BorderlessButton( new BrowseRepositoryAction() ), c );
c.gridx = 3;
c.gridy = 0;
c.fill = GridBagConstraints.NONE;
c.weightx = 0.0;
c.anchor = GridBagConstraints.EAST;
locationFieldPanel.add( new BorderlessButton( new NewFolderAction() ), c );
return locationFieldPanel;
}
private void addLabel(JPanel p, Component c, GridBagConstraints gbc) {
gbc.gridx = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.EAST;
gbc.weightx = 0;
p.add(c, gbc.clone());
}
private void addLabel(JPanel p, Component c, GridBagConstraints gbc) {
gbc.gridx = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.EAST;
gbc.weightx = 0;
p.add(c, gbc.clone());
}
@Override
protected void installGUI(JComponent comp) {
comp.removeAll();
comp.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.weightx = 0;
c.weighty = 0;
c.anchor = GridBagConstraints.EAST;
c.insets = new Insets(5, 5, 5, 5);
comp.add(new JLabel("Look In:"), c);
c.gridx++;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
comp.add(new XPDirectoryControls(this), c);
c.gridy++;
c.gridx = 0;
c.weightx = 0;
c.fill = GridBagConstraints.BOTH;
c.gridheight = GridBagConstraints.REMAINDER;
JPanel sidebar = new JPanel();
sidebar.setBackground(Color.lightGray);
sidebar.setOpaque(true);
comp.add(sidebar, c);
c.gridx++;
c.fill = GridBagConstraints.BOTH;
c.weighty = 1;
c.weightx = 1;
c.gridheight = 1;
comp.add(browser, c);
c.gridy++;
c.weighty = 0;
comp.add(new FileControls(), c);
}
protected JComponent createCodeHighlightBar() {
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
JPanel bar = new JPanel(gridbag);
bar.setBorder(new EmptyBorder(0, 0, 10, 0));
NO_SNIPPET_SELECTED = getString("CodeViewer.snippets.selectOne",
"Select One");
JLabel snippetSetsLabel = new JLabel(getString("CodeViewer.snippets.highlightCode",
"Highlight code to: "));
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.WEST;
c.weightx = 0;
gridbag.addLayoutComponent(snippetSetsLabel, c);
bar.add(snippetSetsLabel);
snippetComboBox = new JComboBox();
snippetComboBox.setMaximumRowCount(20);
snippetComboBox.setRenderer(new SnippetCellRenderer(snippetComboBox.getRenderer()));
snippetComboBox.addActionListener(new SnippetActivator());
snippetSetsLabel.setLabelFor(snippetComboBox);
c.gridx++;
c.weightx = 1;
gridbag.addLayoutComponent(snippetComboBox, c);
bar.add(snippetComboBox);
SnippetNavigator snippetNavigator = new SnippetNavigator(snippetMap);
snippetNavigator.setNavigateNextAction(nextSnippetAction);
snippetNavigator.setNavigatePreviousAction(previousSnippetAction);
c.gridx++;
c.anchor = GridBagConstraints.EAST;
c.weightx = 0;
gridbag.addLayoutComponent(snippetNavigator, c);
bar.add(snippetNavigator);
return bar;
}
@Override
public JPanel createConfigPanel(PalettePanel palettePanel) {
var p = new JPanel(new GridBagLayout());
crSlider = createSlider(cyanRed, "Cyan-red shift");
crSlider.addChangeListener(e -> onNewRed(palettePanel));
mgSlider = createSlider(magentaGreen, "Magenta-green shift");
mgSlider.addChangeListener(e -> onNewGreen(palettePanel));
ybSlider = createSlider(yellowBlue, "Yellow-Blue shift");
ybSlider.addChangeListener(e -> onNewBlue(palettePanel));
Insets insets = new Insets(2, 4, 2, 4);
var labelCtr = new GridBagConstraints(0, 0, 1, 1, 0, 0,
GridBagConstraints.CENTER,
GridBagConstraints.NONE, insets, 0, 0);
var sliderCtr = new GridBagConstraints(1, 0, 1, 1, 1.0, 0,
GridBagConstraints.EAST,
GridBagConstraints.HORIZONTAL, insets, 0, 0);
p.add(new JLabel("C-R:"), labelCtr);
p.add(crSlider, sliderCtr);
labelCtr.gridy = 1;
p.add(new JLabel("M-G:"), labelCtr);
sliderCtr.gridy = 1;
p.add(mgSlider, sliderCtr);
labelCtr.gridy = 2;
p.add(new JLabel("Y-B:"), labelCtr);
sliderCtr.gridy = 2;
p.add(ybSlider, sliderCtr);
return p;
}
private void initComponents() {
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 32, 0 };
gridBagLayout.rowHeights = new int[] { 24, 0 };
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
setLayout(gridBagLayout);
JPanel containerPanel = new JPanel();
containerPanel.setBorder(new CompoundBorder(new TitledBorder(Localizer
.localize("LuminanceSettingsBorderTitle")), new EmptyBorder(5, 5, 5, 5)));
GridBagConstraints gbc_containerPanel = new GridBagConstraints();
gbc_containerPanel.fill = GridBagConstraints.HORIZONTAL;
gbc_containerPanel.anchor = GridBagConstraints.NORTH;
gbc_containerPanel.gridx = 0;
gbc_containerPanel.gridy = 0;
add(containerPanel, gbc_containerPanel);
GridBagLayout gbl_containerPanel = new GridBagLayout();
gbl_containerPanel.columnWidths = new int[] { 0, 0, 0 };
gbl_containerPanel.rowHeights = new int[] { 24, 0 };
gbl_containerPanel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
gbl_containerPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
containerPanel.setLayout(gbl_containerPanel);
JLabel luminanceLabel = new JLabel(Localizer.localize("LuminanceThresholdLabelText"));
luminanceLabel.setFont(UIManager.getFont("Label.font"));
GridBagConstraints gbc_luminanceLabel = new GridBagConstraints();
gbc_luminanceLabel.insets = new Insets(0, 0, 0, 5);
gbc_luminanceLabel.anchor = GridBagConstraints.EAST;
gbc_luminanceLabel.gridx = 0;
gbc_luminanceLabel.gridy = 0;
containerPanel.add(luminanceLabel, gbc_luminanceLabel);
luminanceSpinner = new JSpinner();
luminanceSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
luminanceStateChanged(e);
}
});
luminanceSpinner.setModel(new SpinnerNumberModel(165, 0, 255, 1));
luminanceSpinner.setFont(UIManager.getFont("Spinner.font"));
GridBagConstraints gbc_luminanceSpinner = new GridBagConstraints();
gbc_luminanceSpinner.anchor = GridBagConstraints.WEST;
gbc_luminanceSpinner.gridx = 1;
gbc_luminanceSpinner.gridy = 0;
containerPanel.add(luminanceSpinner, gbc_luminanceSpinner);
}
private void addBoundingBox() {
JPanel bboxPanel = new JPanel();
bboxPanel.setLayout(new GridBagLayout());
JLabel title = new JLabel(Language.I18N.getString("map.boundingBox.label"));
title.setFont(title.getFont().deriveFont(Font.BOLD));
title.setIcon(new ImageIcon(getClass().getResource("/org/citydb/gui/images/map/selection.png")));
title.setIconTextGap(5);
JLabel lowerLabel = new JLabel("Xmin / Ymin");
JLabel upperLabel = new JLabel("Xmax / Ymax");
JLabel lower = new JLabel(String.valueOf(bbox.getLowerCorner().getX()) + " / " + String.valueOf(bbox.getLowerCorner().getY()));
JLabel upper = new JLabel(String.valueOf(bbox.getUpperCorner().getX()) + " / " + String.valueOf(bbox.getUpperCorner().getY()));
bboxPanel.add(title, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,2,0,5));
bboxPanel.add(new JSeparator(JSeparator.HORIZONTAL), GuiUtil.setConstraints(1,0,1.0,0.0,GridBagConstraints.HORIZONTAL,0,10,0,5));
GridBagConstraints c = GuiUtil.setConstraints(0,1,0.0,0.0,GridBagConstraints.NONE,5,5,0,5);
c.anchor = GridBagConstraints.EAST;
bboxPanel.add(lowerLabel, c);
bboxPanel.add(lower, GuiUtil.setConstraints(1,1,1.0,0.0,GridBagConstraints.HORIZONTAL,5,20,0,5));
c = GuiUtil.setConstraints(0,2,0.0,0.0,GridBagConstraints.NONE,5,5,0,5);
c.anchor = GridBagConstraints.EAST;
bboxPanel.add(upperLabel, c);
bboxPanel.add(upper, GuiUtil.setConstraints(1,2,1.0,0.0,GridBagConstraints.HORIZONTAL,5,20,0,5));
if (bbox.isSetSrs()) {
String sridText = bbox.getSrs().getSrid() != 0 ? String.valueOf(bbox.getSrs().getSrid()) : "n/a";
JLabel description = new JLabel(bbox.getSrs().getDescription());
JLabel srid = new JLabel(sridText);
c = GuiUtil.setConstraints(0,3,0.0,0.0,GridBagConstraints.NONE,5,5,0,5);
c.anchor = GridBagConstraints.EAST;
bboxPanel.add(new JLabel(Language.I18N.getString("pref.db.srs.label.description")), c);
bboxPanel.add(description, GuiUtil.setConstraints(1,3,1.0,0.0,GridBagConstraints.HORIZONTAL,5,20,0,5));
c = GuiUtil.setConstraints(0,4,0.0,0.0,GridBagConstraints.NONE,5,5,0,5);
c.anchor = GridBagConstraints.EAST;
bboxPanel.add(new JLabel(Language.I18N.getString("pref.db.srs.label.srid")), c);
bboxPanel.add(srid, GuiUtil.setConstraints(1,4,1.0,0.0,GridBagConstraints.HORIZONTAL,5,20,0,5));
}
add(bboxPanel, GuiUtil.setConstraints(0, row++, 1, 0, GridBagConstraints.BOTH, 5, 5, 5, 5));
}
private void setupPanel() {
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1;
gbc.insets = new Insets( 2, 0, 2, 2 );
this.setLayout( gbl );
addLabeledComponentToGBL( "Font: ", fontMenu, gbl, gbc, this );
addLabeledComponentToGBL( "Size: ", sizeField, gbl, gbc, this );
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Font Transform:",
transformMenu, gbl, gbc, this );
gbc.gridwidth = 1;
addLabeledComponentToGBL( "Range: ", rm, gbl, gbc, this );
addLabeledComponentToGBL( "Style: ", styleMenu, gbl, gbc, this );
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Graphics Transform: ",
transformMenuG2, gbl, gbc, this );
gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.WEST;
addLabeledComponentToGBL( "Method: ", methodsMenu, gbl, gbc, this );
addLabeledComponentToGBL("", null, gbl, gbc, this);
gbc.anchor = GridBagConstraints.EAST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Text to use:", textMenu, gbl, gbc, this );
gbc.weightx=1;
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
addLabeledComponentToGBL("LCD contrast: ",
contrastSlider, gbl, gbc, this);
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.NONE;
addLabeledComponentToGBL("Antialiasing: ",
antiAliasMenu, gbl, gbc, this);
gbc.anchor = GridBagConstraints.EAST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL("Fractional metrics: ",
fracMetricsMenu, gbl, gbc, this);
gbc.weightx = 1;
gbc.weighty = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets( 2, 0, 0, 2 );
gbc.fill = GridBagConstraints.BOTH;
gbl.setConstraints( fp, gbc );
this.add( fp );
gbc.weighty = 0;
gbc.insets = new Insets( 0, 2, 0, 0 );
gbl.setConstraints( statusBar, gbc );
this.add( statusBar );
}
public InformationDialog(String title, String message, ImportScreen owner) {
super(title);
this.label = new JLabel(message);
// This keeps the progressbar size correct after setMessage
// label.setPreferredSize(new Dimension(
// (int)PROGRESSBAR_SIZE.getWidth() + 100,
// (int)PROGRESSBAR_SIZE.getHeight()));
label.setPreferredSize(PROGRESSBAR_SIZE);
this.owner = owner;
cancelButton = new JButton("Cancel");
cancelButton.setPreferredSize(BUTTON_SIZE);
cancelButton.addActionListener(this);
progressBar = new JProgressBar();
progressBar.setPreferredSize(PROGRESSBAR_SIZE);
contentPane = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
// Label
c.anchor = GridBagConstraints.WEST;
c.insets.set(8, 12, 10, 4);
c.gridx = 0;
c.gridy = 0;
contentPane.add(label, c);
// Combobox
c.insets.set(0, 12, 8, 12);
c.gridy = 1;
contentPane.add(progressBar, c);
// Buttons
c.insets.set(4, 2, 12, 8);
c.anchor = GridBagConstraints.EAST;
c.gridy = 2;
contentPane.add(cancelButton, c);
logger.debug("Components on the dialog: " + contentPane.getComponentCount());
this.add(contentPane);
this.pack();
this.setLocationRelativeTo(null);
}
private void setupPanel() {
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1;
gbc.insets = new Insets( 2, 0, 2, 2 );
this.setLayout( gbl );
addLabeledComponentToGBL( "Font: ", fontMenu, gbl, gbc, this );
addLabeledComponentToGBL( "Size: ", sizeField, gbl, gbc, this );
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Font Transform:",
transformMenu, gbl, gbc, this );
gbc.gridwidth = 1;
addLabeledComponentToGBL( "Range: ", rm, gbl, gbc, this );
addLabeledComponentToGBL( "Style: ", styleMenu, gbl, gbc, this );
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Graphics Transform: ",
transformMenuG2, gbl, gbc, this );
gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.WEST;
addLabeledComponentToGBL( "Method: ", methodsMenu, gbl, gbc, this );
addLabeledComponentToGBL("", null, gbl, gbc, this);
gbc.anchor = GridBagConstraints.EAST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL( "Text to use:", textMenu, gbl, gbc, this );
gbc.weightx=1;
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
addLabeledComponentToGBL("LCD contrast: ",
contrastSlider, gbl, gbc, this);
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.NONE;
addLabeledComponentToGBL("Antialiasing: ",
antiAliasMenu, gbl, gbc, this);
gbc.anchor = GridBagConstraints.EAST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
addLabeledComponentToGBL("Fractional metrics: ",
fracMetricsMenu, gbl, gbc, this);
gbc.weightx = 1;
gbc.weighty = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets( 2, 0, 0, 2 );
gbc.fill = GridBagConstraints.BOTH;
gbl.setConstraints( fp, gbc );
this.add( fp );
gbc.weighty = 0;
gbc.insets = new Insets( 0, 2, 0, 0 );
gbl.setConstraints( statusBar, gbc );
this.add( statusBar );
}
protected JPanel createControlPanel() {
JPanel controlPanel = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
controlPanel.setLayout(gridbag);
c.gridx = 0;
c.gridy = 1;
c.gridheight = 1;
c.insets = new Insets(20, 10, 0, 10);
c.anchor = GridBagConstraints.SOUTHWEST;
JLabel searchLabel = new JLabel(getString("TableDemo.searchLabel",
"Search Titles and Recipients"));
controlPanel.add(searchLabel, c);
c.gridx = 0;
c.gridy = 2;
c.weightx = 1.0;
c.insets.top = 0;
c.insets.bottom = 12;
c.anchor = GridBagConstraints.SOUTHWEST;
//c.fill = GridBagConstraints.HORIZONTAL;
filterField = new JTextField(24);
filterField.getDocument().addDocumentListener(new SearchFilterListener());
controlPanel.add(filterField, c);
c.gridx = 1;
c.gridy = 2;
c.gridwidth = GridBagConstraints.REMAINDER;
//c.insets.right = 24;
//c.insets.left = 12;
c.weightx = 0.0;
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.NONE;
winnersCheckbox = new JCheckBox(getString("TableDemo.winnersLabel",
"Show Only Winners"));
winnersCheckbox.addChangeListener(new ShowWinnersListener());
controlPanel.add(winnersCheckbox, c);
return controlPanel;
}
private void setupGUI() {
setTitle("About " + ClientGlobals.APPNAME);
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(0,LEFT_MARGIN, 0,0);
c.anchor = GridBagConstraints.NORTHWEST;
c.weighty = 1;
// LEFT COLUMN
c.weightx = LEFT_WEIGHT;
c.gridx = 0; c.gridy = 0;
c.gridwidth = 1; c.insets = new Insets(INIT_VERT_SPACE,LEFT_MARGIN,0 ,0);
add(getHeaderJLabel(ClientGlobals.APPNAME),c);
// logo
c.gridx++;
c.gridwidth = 1; c.gridheight = 2 ;
c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(LOGO_TOPMARG,0,0,0);
add(new JLabel(new ImageIcon(this.getClass().getResource("/resources/images/logo.gif"))),c);
c.anchor = GridBagConstraints.NORTHWEST;
c.gridwidth = 1; c.gridheight = 1;
c.gridx=0;
c.gridy++; c.insets = new Insets(0,LEFT_MARGIN, VERT_SPACE_AFTER_TOP,0);
add(getNormalJLabel(ClientGlobals.VERSION ),c);
c.anchor = GridBagConstraints.NORTHWEST;
c.gridx = 0; c.gridheight = 1;
c.gridwidth = 1; c.insets = new Insets(0,LEFT_MARGIN, EXTRA_AFTER_AUTHOR,0);
c.gridy++;
add(getBoldJLabel("Developed by:"),c);
c.insets = new Insets(0,LEFT_MARGIN, 0,0);
c.gridy++; c.insets = new Insets(0,LEFT_MARGIN, EXTRA_AFTER_CONTACT,0);
add(getBoldJLabel("Web:"),c);
c.gridy++; c.insets = new Insets(0,LEFT_MARGIN, VERT_SPACE,0);
add(getBoldJLabel("Thanks to:"),c);
c.gridy+=3;
add(getBoldJLabel("Logo:"),c);
c.gridy++;
add(getBoldJLabel("Institution:"),c);
// RIGHT COLUMN
c.weightx = RIGHT_WEIGHT;
c.gridx = 1; c.gridy = 2;
add(getBoldJLabel("Jan Krumsiek, Thomas Rattei"),c);
c.gridy++; c.insets = new Insets(0,LEFT_MARGIN, BETWEEN_CONTACT_WEB,0);
add(getLinkJLabel(ClientGlobals.WEB_ADRESS),c);
// c.gridy++;
c.gridy++; c.insets = new Insets(0,LEFT_MARGIN, 0,0);
add(getNormalJLabel("Roland Arnold, Patrick Tischler, "),c);
c.gridy++; c.insets = new Insets(0,LEFT_MARGIN, VERT_SPACE,0);
add(getNormalJLabel("Dominik Lindner, Volker Stuempflen, Tini" ),c);
c.gridy++;c.gridy++;
add(getNormalJLabel("Tobias Petri" ),c);
c.gridy++;
add(getNormalJLabel("Division of Computational Systems Biology" ),c);
c.gridy++;
add(getNormalJLabel("University of Vienna" ),c);
c.gridy++; c.gridy++; c.anchor = GridBagConstraints.EAST;
c.insets = new Insets(0,0,BELOW_CLOSE,LEFT_MARGIN);
close = new JButton("Close");
add(close,c);
close.addActionListener(this);
c.gridx--;
c.insets = new Insets(0,LEFT_MARGIN,0,0);
c.anchor = GridBagConstraints.WEST;
ref = new JButton("Reference");
add(ref,c);
ref.addActionListener(this);
}
/**
*
*/
private void initGUI() {
this.setLayout( new GridBagLayout() );
final GridBagConstraints constraints = new GridBagConstraints();
// Add the width label
constraints.gridx = 0;
constraints.gridy = 0;
constraints.anchor = GridBagConstraints.EAST;
this.add( new JLabel( "Width:" ), constraints );
// Add the spinner with its model
constraints.gridx = 1;
constraints.gridy = 0;
constraints.anchor = GridBagConstraints.WEST;
final JTextField strokeWidthField = new JTextField();
strokeWidthField.getDocument().addDocumentListener( new WidthUpdateHandler( strokeWidthField ) );
strokeWidthField.setText( String.valueOf( width ) );
strokeWidthField.setColumns( 6 );
this.add( strokeWidthField, constraints );
// Add the dash Label
constraints.gridx = 0;
constraints.gridy = 1;
constraints.anchor = GridBagConstraints.CENTER;
this.add( new JLabel( "Dashes:" ), constraints );
// Add the dash comboBox
constraints.gridx = 1;
constraints.gridy = 1;
final JComboBox dashComboBox =
new JComboBox( new Object[] { BorderStyle.SOLID, BorderStyle.DASHED, BorderStyle.DOTTED,
BorderStyle.DOT_DASH, BorderStyle.DOT_DOT_DASH } );
dashComboBox.setRenderer( new BorderStyleRenderer() );
dashComboBox.setSelectedItem( borderStyle );
dashComboBox.addActionListener( new DashSelectionHandler( dashComboBox ) );
this.add( dashComboBox, constraints );
// Add the sample box
constraints.gridx = 0;
constraints.gridy = 2;
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.fill = GridBagConstraints.HORIZONTAL;
this.add( samplePanel, constraints );
}
@Override
protected JPanel assemble() {
blankloader = new ImageIcon(new BufferedImage(43, 11,
BufferedImage.TYPE_INT_ARGB));
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
GridBagConstraints gbc = new GridBagConstraints();
sidebar = new JPanel();
sidebar.setLayout(new CardLayout());
sidebar.add(
new OverviewBuilder().withBorder(BorderFactory.createEtchedBorder())
.build(globals), WELCOME);
sidebar.setPreferredSize(new Dimension(450, 700));
serp = new JPanel();
serp.setLayout(new CardLayout());
serp.add(new JPanel(), WELCOME);
serp.setPreferredSize(new Dimension(550, 700));
query = new JTextField(20);
query.setMargin(new Insets(2, 2, 2, 2));
search = new JButton(Messages.getLocalizer().localize("search"));
query.addActionListener(this);
search.addActionListener(this);
query.requestFocusInWindow();
JPanel container = new JPanel();
container.setLayout(new GridBagLayout());
busy = new JLabel(blankloader);
busy.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(0, 30, 0, 30);
container.add(busy, gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.CENTER;
gbc.weightx = 1;
gbc.insets = new Insets(0, 0, 0, 5);
container.add(query, gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.EAST;
gbc.weightx = 0;
gbc.insets = new Insets(0, 0, 0, 0);
container.add(search, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 3;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(5, 10, 10, 0);
container.add(new JSeparator(Separator.HORIZONTAL), gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 3;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.insets = new Insets(10, 10, 0, 0);
container.add(serp, gbc);
panel.add(container);
panel.add(sidebar, BorderLayout.WEST);
globals.get(PlayManager.class).addPlayListener(this);
globals.get(BridgeManager.class).addBridgeListener(this);
globals.get(DatabaseManager.class).get(VariableDao.class)
.addDataSetListener(new DatasetListenerProxy(this));
globals.get(DatabaseManager.class).get(PlayProfileDao.class)
.subscribe(new DatasetListenerProxy(this));
Focus.on(query);
return panel;
}
private JPanel getStartStatePanel() {
final JPanel thePanel = new JPanel();
thePanel.setLayout( new GridBagLayout() );
// thePanel.setBorder( new TitledBorder( "" ));
final GridBagConstraints theCons = DomGui.getGridBagConstraints( 2 );
//starting hand
thePanel.add(new JLabel("Starting Hand"),theCons);
myStartingHandField = new JTextField(TEXT_FIELD_WIDTH);
theCons.gridx++;
thePanel.add(myStartingHandField,theCons);
//starting discard
theCons.gridx=0;
theCons.gridy++;
thePanel.add(new JLabel("Starting discard pile"),theCons);
myStartingDiscardPile = new JTextField(TEXT_FIELD_WIDTH);
theCons.gridx++;
thePanel.add(myStartingDiscardPile,theCons);
//starting draw deck
theCons.gridx=0;
theCons.gridy++;
thePanel.add(new JLabel("Starting draw deck"),theCons);
myStartingDrawDeckField = new JTextField(TEXT_FIELD_WIDTH);
theCons.gridx++;
thePanel.add(myStartingDrawDeckField,theCons);
myShuffleDeckBox = new JCheckBox("Shuffle draw deck", null, true);
// theCons.gridx++;
theCons.gridx=0;
theCons.gridy++;
thePanel.add(myShuffleDeckBox,theCons);
//info button
JButton theInfoBTN = new JButton("Info");
theInfoBTN.setMnemonic('I');
theInfoBTN.addActionListener(this);
theInfoBTN.setActionCommand("StartStateInfo");
theCons.gridx++;
theCons.fill=GridBagConstraints.NONE;
theCons.anchor=GridBagConstraints.EAST;
thePanel.add(theInfoBTN,theCons);
StartState theStartState = myChosenStrategy.getStartState();
if (theStartState!=null) {
myStartingDiscardPile.setText(theStartState.myOriginalDiscard);
myStartingDrawDeckField.setText(theStartState.myOriginalDrawDeck);
myStartingHandField.setText(theStartState.myOriginalHand);
myShuffleDeckBox.setSelected(theStartState.isShuffleDrawDeck());
}
return thePanel;
}
public ClipboardImportDialog(ClientApplication client) {
super(Session.getSession().getFrames().getMainFrame(), true);
this.client = client;
this.setTitle("Import data from clipboard");
this.setModal(true);
label = new JLabel("Filename");
nameField = new JTextField(30);
nameField.setText("clipboard.txt");
nameField.addCaretListener(this);
skipCheckBox = new JCheckBox(VisualConstants.getImportDirectlyText());
if (!Session.getSession().getApplication().isStandalone()) {
skipCheckBox.setSelected(true);
} else {
skipCheckBox.setSelected(false);
}
folderNameCombo = new JComboBox(ImportUtils.getFolderNames(true).toArray());
folderNameCombo.setEditable(true);
okButton = new JButton("OK");
okButton.setPreferredSize(BUTTON_SIZE);
okButton.addActionListener(this);
cancelButton = new JButton("Cancel");
cancelButton.setPreferredSize(BUTTON_SIZE);
cancelButton.addActionListener(this);
GridBagConstraints c = new GridBagConstraints();
this.setLayout(new GridBagLayout());
// Label
c.anchor = GridBagConstraints.WEST;
c.insets.set(10, 10, 5, 10);
c.gridx = 0;
c.gridy = 0;
this.add(label, c);
// Combobox
c.insets.set(0, 10, 10, 10);
c.gridy++;
this.add(nameField, c);
c.insets.set(10, 10, 5, 10);
c.gridy++;
this.add(new JLabel("Insert in folder"), c);
c.fill = GridBagConstraints.HORIZONTAL;
c.insets.set(0, 10, 10, 10);
c.gridy++;
this.add(folderNameCombo, c);
c.insets.set(10, 10, 10, 10);
c.anchor = GridBagConstraints.EAST;
c.gridy++;
this.add(skipCheckBox, c);
c.fill = GridBagConstraints.NONE;
// Buttons
c.insets.set(10, 10, 10, 10);
c.anchor = GridBagConstraints.EAST;
c.gridy++;
JPanel keepButtonsRightPanel = new JPanel();
keepButtonsRightPanel.add(okButton);
keepButtonsRightPanel.add(cancelButton);
this.add(keepButtonsRightPanel, c);
if (this.isDataAvailable()) {
this.pack();
Session.getSession().getFrames().setLocationRelativeToMainFrame(this);
this.setVisible(true);
} else {
JOptionPane.showMessageDialog(this, "There is no text content on the clipboard");
this.dispose();
}
}
protected JPanel createControlPanel() {
JPanel controlPanel = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
controlPanel.setLayout(gridbag);
c.gridx = 0;
c.gridy = 1;
c.gridheight = 1;
c.insets = new Insets(20, 10, 0, 10);
c.anchor = GridBagConstraints.SOUTHWEST;
JLabel searchLabel = new JLabel(getString("TableDemo.searchLabel",
"Search Titles and Recipients"));
controlPanel.add(searchLabel, c);
c.gridx = 0;
c.gridy = 2;
c.weightx = 1.0;
c.insets.top = 0;
c.insets.bottom = 12;
c.anchor = GridBagConstraints.SOUTHWEST;
// c.fill = GridBagConstraints.HORIZONTAL;
filterField = new JTextField(24);
filterField.getDocument().addDocumentListener(
new SearchFilterListener());
controlPanel.add(filterField, c);
c.gridx = 1;
c.gridy = 2;
c.gridwidth = GridBagConstraints.REMAINDER;
// c.insets.right = 24;
// c.insets.left = 12;
c.weightx = 0.0;
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.NONE;
winnersCheckbox = new JCheckBox(getString("TableDemo.winnersLabel",
"Show Only Winners"));
winnersCheckbox.addChangeListener(new ShowWinnersListener());
controlPanel.add(winnersCheckbox, c);
return controlPanel;
}