本文整理汇总了Java中java.awt.FlowLayout.CENTER属性的典型用法代码示例。如果您正苦于以下问题:Java FlowLayout.CENTER属性的具体用法?Java FlowLayout.CENTER怎么用?Java FlowLayout.CENTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.FlowLayout
的用法示例。
在下文中一共展示了FlowLayout.CENTER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AlignmentPropertyEditor
public AlignmentPropertyEditor() {
super(
new int[] {
FlowLayout.CENTER,
FlowLayout.LEFT,
FlowLayout.RIGHT,
FlowLayout.LEADING,
FlowLayout.TRAILING
},
new String[] {
"java.awt.FlowLayout.CENTER", // NOI18N
"java.awt.FlowLayout.LEFT", // NOI18N
"java.awt.FlowLayout.RIGHT", // NOI18N
"java.awt.FlowLayout.LEADING", // NOI18N
"java.awt.FlowLayout.TRAILING" // NOI18N
},
new String[] {
"VALUE_AlignmentCenter", // NOI18N
"VALUE_AlignmentLeft", // NOI18N
"VALUE_AlignmentRight", // NOI18N
"VALUE_AlignmentLeading", // NOI18N
"VALUE_AlignmentTrailing" // NOI18N
}
);
}
示例2: buildDisplay
@Override
protected void buildDisplay() {
JPanel queryPane = new JPanel(new BorderLayout());
JLabel leading = new JLabel(" ?- ");
leading.setFont(leading.getFont().deriveFont(Font.BOLD));
queryPane.add(leading, BorderLayout.WEST);
queryPane.add(getQueryField(), BorderLayout.CENTER);
JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
buttonsPane.add(createExecuteButton());
buttonsPane.add(getNextResultButton());
buttonsPane.setBorder(null);
queryPane.add(buttonsPane, BorderLayout.EAST);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(.4);
splitPane.setBottomComponent(getTabPane());
splitPane.setTopComponent(getResultsPanel());
JPanel mainPane = new JPanel(new BorderLayout());
mainPane.add(queryPane, BorderLayout.NORTH);
mainPane.add(splitPane, BorderLayout.CENTER);
setLayout(new BorderLayout());
add(mainPane, BorderLayout.CENTER);
}
示例3: DeptView
public DeptView(Controller controller) {
this.controller = controller;
frame = new JFrame();
namePanel = new JPanel(new GridLayout(1, 2, 0, 0));
managerPanel = new JPanel(new GridLayout(1, 2, 66, 0));
employeePanel = new JPanel(new GridLayout(1, 2, 30, 0));
subDeptPanel = new JPanel(new GridLayout(1, 2, 20, 0));
salaryPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 0));
buttonPanel = new JPanel(new GridLayout(1, 3, 20, 0));
subDeptLabel = new JLabel();
salaryLabel = new JLabel();
cutButton = new JButton();
saveButton = new JButton();
okButton = new JButton();
cancelButton = new JButton();
nameField = new JTextField();
managerButton = new JButton();
employeeListModel = new DefaultListModel();
subDeptListModel = new DefaultListModel();
employeeList = new JList(employeeListModel);
subDeptList = new JList(subDeptListModel);
init();
}
示例4: buttonPanel
private Component buttonPanel() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
accept = new JButton("Accept");
accept.setFont(new Font("Arial", Font.PLAIN, 14));
accept.setPreferredSize(new Dimension(110, 30));
accept.setMnemonic(KeyEvent.VK_A);
accept.setActionCommand("accept");
accept.addActionListener(this);
JButton cancel = new JButton("Cancel");
cancel.setFont(new Font("Arial", Font.PLAIN, 14));
cancel.setPreferredSize(new Dimension(110, 30));
cancel.setMnemonic(KeyEvent.VK_C);
cancel.setActionCommand("cancel");
cancel.addActionListener(this);
panel.add(accept);
panel.add(Box.createRigidArea(new Dimension(50, 0)));
panel.add(cancel);
return panel;
}
示例5: buildRightPanel
private void buildRightPanel() {
JPanel tableButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
// Buttons
tableButtonPanel.add(newRowButton);
tableButtonPanel.add(removeRowButton);
JPanel southButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
southButtonPanel.add(insertButton);
selectedTableViewer.add(tableButtonPanel, BorderLayout.NORTH);
selectedTableViewer.add(southButtonPanel, BorderLayout.SOUTH);
JScrollPane contentTablePanelSP = new JScrollPane(selectedTableViewer);
contentTablePanelSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// Remove ugly borders
contentTablePanelSP.setViewportBorder(null);
JPanel bottomPanel = new JPanel(new BorderLayout());
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonsPanel.add(doneButton);
bottomPanel.add(buttonsPanel, BorderLayout.SOUTH);
getRightPanel().add(selectedTableViewer, BorderLayout.CENTER);
getRightPanel().add(bottomPanel, BorderLayout.SOUTH);
}
示例6: NewDatabaseDialog
public NewDatabaseDialog() {
newDatabaseNameField = new JTextField();
nextButton = new JButton("NEXT");
newDatabaseNameField.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
setLayout(new BorderLayout());
EmptyBorder padding = new EmptyBorder(5, 5, 5, 5);
JPanel textFieldPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
textFieldPanel.setBorder(padding);
buttonsPanel.setBorder(padding);
textFieldPanel.add(new JLabel("DB name: "));
textFieldPanel.add(newDatabaseNameField);
buttonsPanel.add(nextButton);
add(textFieldPanel, BorderLayout.NORTH);
add(buttonsPanel, BorderLayout.SOUTH);
buildWindow();
}
示例7: getPlotter
/**
* Returns this. Subclasses which do not want to use this object (JPanel) for plotting should
* directly implement {@link Plotter}.
*/
@Override
public JComponent getPlotter() {
if (this.plotpanel == null) {
this.plotpanel = createPlotPanel();
if (hasLegend()) {
this.plotpanel.addLegend(LEGEND_POSITION);
}
GridBagLayout layout = new GridBagLayout();
this.setLayout(layout);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
if (hasRapidMinerValueLegend()) {
legend = new PlotterLegend(this);
c.weighty = 0;
JPanel legendPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
legendPanel.setBackground(Color.white);
legendPanel.add(legend);
layout.setConstraints(legendPanel, c);
add(legendPanel);
}
c.weighty = 1;
layout.setConstraints(plotpanel, c);
add(plotpanel);
}
return this;
}
示例8: getNumberPanel
/** Returns the text field in which the user is to enter his input. */
private JPanel getNumberPanel() {
if (this.numberPanel == null) {
this.numberPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 0));
this.numberPanel.add(new JLabel(this.prompt));
this.numberPanel.add(getNumberField());
}
return this.numberPanel;
}
示例9: createBottom
private JPanel createBottom()
{
addButton = new JButton(CurrentLocale.get("com.tle.admin.add")); //$NON-NLS-1$
removeButton = new JButton(CurrentLocale.get("com.tle.admin.remove")); //$NON-NLS-1$
addButton.addActionListener(this);
removeButton.addActionListener(this);
updateButtons();
JPanel all = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
all.add(addButton);
all.add(removeButton);
return all;
}
示例10: createSelectButtons
protected JPanel createSelectButtons()
{
Icon configureIcon = new ImageIcon(AdminToolSelect.class.getResource(CONFIGURE_ICON));
selectButton = new JHoverButton(CurrentLocale.get("com.tle.admin.gui.admintoolselect.configure"), configureIcon);
selectButton.setBorderPainted(false);
selectButton.addActionListener(this);
buttons = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
buttons.add(selectButton);
return buttons;
}
示例11: createWrapperSelectButtons
protected JPanel createWrapperSelectButtons()
{
Icon configureIcon = new ImageIcon(AdminToolSelect.class.getResource(SELECT_WRAPPER_ICON));
selectWrapperButton = new JHoverButton(CurrentLocale.get("com.tle.admin.gui.admintoolselect.configure"),
configureIcon);
selectWrapperButton.setBorderPainted(false);
selectWrapperButton.addActionListener(this);
buttons = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
buttons.add(selectWrapperButton);
return buttons;
}
示例12: StartupProgressDialog
public StartupProgressDialog(ZCashClientCaller clientCaller)
{
this.clientCaller = clientCaller;
URL iconUrl = this.getClass().getClassLoader().getResource("images/ZEN-yellow.orange-logo.png");
imageIcon = new ImageIcon(iconUrl);
imageLabel.setIcon(imageIcon);
imageLabel.setBorder(BorderFactory.createEmptyBorder(16, 16, 0, 16));
Container contentPane = getContentPane();
contentPane.setLayout(borderLayout1);
southPanel.setLayout(southPanelLayout);
southPanel.setBorder(BorderFactory.createEmptyBorder(0, 16, 16, 16));
contentPane.add(imageLabel, BorderLayout.NORTH);
JLabel zcashWalletLabel = new JLabel(
"<html><span style=\"font-style:italic;font-weight:bold;font-size:2.2em\">" +
"ZENCash Wallet</span></html>");
zcashWalletLabel.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16));
// todo - place in a panel with flow center
JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 1));
tempPanel.add(zcashWalletLabel);
contentPane.add(tempPanel, BorderLayout.CENTER);
contentPane.add(southPanel, BorderLayout.SOUTH);
progressBar.setIndeterminate(true);
southPanel.add(progressBar, BorderLayout.NORTH);
progressLabel.setText("Starting...");
southPanel.add(progressLabel, BorderLayout.SOUTH);
pack();
setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
}
示例13: moveComponents
/**
* Centers the elements in the specified row, if there is any slack.
* @param target the component which needs to be moved
* @param x the x coordinate
* @param y the y coordinate
* @param width the width dimensions
* @param height the height dimensions
* @param rowStart the beginning of the row
* @param rowEnd the the ending of the row
* @param ltr
* @param ruler
*/
protected void moveComponents(Container target, int x, int y, int width,
int height, int rowStart, int rowEnd, boolean ltr, Ruler ruler) {
synchronized (target.getTreeLock()) {
switch (getAlignment()) {
case FlowLayout.LEFT:
x += ltr ? 0 : width;
break;
case FlowLayout.CENTER:
x += width / 2;
break;
case FlowLayout.RIGHT:
x += ltr ? width : 0;
break;
case LEADING:
break;
case TRAILING:
x += width;
break;
}
int tabIndex = 0;
for (int i = rowStart; i < rowEnd; i++) {
Component m = target.getComponent(i);
// if (m.isVisible()) {
if (hasConstraint(m, TAB_STOP))
x = getInsets(target).left + ruler.getTab(tabIndex++);
int dy = (valign == VTOP) ? 0 : (height - m.getHeight()) / 2;
if (ltr) {
m.setLocation(x, y + dy);
} else {
m.setLocation(target.getWidth() - x - m.getWidth(), y + dy);
}
x += m.getWidth() + hgap;
// }
}
}
}
示例14: AbstractAddEditConstraintDialog
protected AbstractAddEditConstraintDialog(
NetworkEntity<AbstractConstraint> ne, int lyr, Window owner,
Dimension dim) {
super(owner);
setLayout(new BorderLayout());
setSize(dim);
setModalityType(DEFAULT_MODALITY_TYPE);
setResizable(false);
setLocationRelativeTo(getOwner());
entity = ne;
layer = lyr;
if (layer == 0) {
constraintStr = "Resource";
} else {
constraintStr = "Demand";
}
// set the title after entity and constraintStr have been set
setTitle(getTitleText());
// Button panel.
JPanel btnPanel = new JPanel();
JButton actionBtn = new JButton(getButtonText());
actionBtn.addActionListener(this);
btnPanel.add(actionBtn);
JButton cancelBtn = new JButton("Cancel");
cancelBtn.setActionCommand("cancel");
cancelBtn.addActionListener(this);
btnPanel.add(cancelBtn);
// The content panel. It contains the ComboBox and the params panel.
final JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER));
content.add(new JLabel(getComboBoxLabelText()));
comboBox = new JComboBox<Object>(getComboBoxObjects());
content.add(comboBox);
paramsPanel = new JPanel(new GridLayout(1, 2, 10, 10));
content.add(paramsPanel);
content.updateUI();
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// remove all elements from the panel, do the specified action
// and update
paramsPanel.removeAll();
doComboBoxAction();
paramsPanel.updateUI();
}
});
add(content, BorderLayout.CENTER);
add(btnPanel, BorderLayout.SOUTH);
setVisible(true);
}
示例15: UnknownParametersInfoDialog
public UnknownParametersInfoDialog(Frame owner, List<UnknownParameterInformation> unknownParameters) {
super(owner, "Unknown Parameters", true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(new BorderLayout());
setModal(true);
// text
JTextArea text = new JTextArea();
text.setLineWrap(true);
text.setWrapStyleWord(true);
text.setBackground(getBackground());
text.setEditable(false);
String textString = "The following table shows all parameters which are not (no longer) valid. This can happen for several reasons. First, a mistake in the parameter name can cause this error. Second, a parameter was removed and is now no longer supported. Third, a parameter was replaced by a (set of) other parameter(s). Please ensure that the process still performs the desired task by checking the parameter settings manually.";
text.setText(textString);
text.setBorder(BorderFactory.createEmptyBorder(11, 11, 11, 11));
add(text, BorderLayout.NORTH);
// table
ExtendedJTable table = new ExtendedJTable(new UnknownParametersTableModel(unknownParameters), true, true, true);
ExtendedJScrollPane pane = new ExtendedJScrollPane(table);
pane.setBorder(BorderFactory.createEmptyBorder(11, 11, 11, 11));
add(pane, BorderLayout.CENTER);
// ok button
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton okButton = new JButton("Ok");
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ok();
}
});
buttonPanel.add(okButton);
add(buttonPanel, BorderLayout.SOUTH);
setSize(640, 480);
setLocationRelativeTo(owner);
}