本文整理匯總了Java中javax.swing.JToolBar.setAlignmentX方法的典型用法代碼示例。如果您正苦於以下問題:Java JToolBar.setAlignmentX方法的具體用法?Java JToolBar.setAlignmentX怎麽用?Java JToolBar.setAlignmentX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JToolBar
的用法示例。
在下文中一共展示了JToolBar.setAlignmentX方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TitledPanel
import javax.swing.JToolBar; //導入方法依賴的package包/類
/** Creates a label panel for a given inner component.
* @param name initial title of the component
* @param inner the inner component; non-{@code null}
* @param toolBar the optional tool bar; may be {@code null}
* @param scroll flag indicating if the inner component should be put inside a {@link JScrollPane}
*/
public TitledPanel(String name, JComponent inner, JToolBar toolBar,
boolean scroll) {
super(new BorderLayout(), false);
setBorder(null);
this.titleLabel = new JLabel();
this.titleLabel.setAlignmentX(LEFT_ALIGNMENT);
setName(name);
this.inner = inner;
this.labelPanelTop = Box.createVerticalBox();
this.labelPanelTop.add(this.titleLabel);
if (toolBar != null) {
toolBar.setAlignmentX(LEFT_ALIGNMENT);
this.labelPanelTop.add(toolBar);
}
add(this.labelPanelTop, BorderLayout.NORTH);
add(scroll ? new JScrollPane(inner) : inner, BorderLayout.CENTER);
}
示例2: FilesPanel
import javax.swing.JToolBar; //導入方法依賴的package包/類
public FilesPanel(VCSCommitPanel master, Map<String, VCSCommitFilter> filters, int preferedHeight) {
super(master, master.getModifier().getMessage(VCSCommitPanelModifier.BundleMessage.FILE_PANEL_TITLE), DEFAULT_DISPLAY_FILES);
this.filters = filters;
master.getCommitTable().labelFor(filesLabel);
JComponent table = master.getCommitTable().getComponent();
Mnemonics.setLocalizedText(filesLabel, getMessage("CTL_CommitForm_FilesToCommit")); // NOI18N
filesLabel.setMaximumSize(new Dimension(Integer.MAX_VALUE, filesLabel.getMaximumSize().height));
table.setPreferredSize(new Dimension(0, preferedHeight));
ButtonGroup bg = new ButtonGroup();
toolbar = new JToolBar();
toolbar.setFloatable(false);
for (VCSCommitFilter filter : filters.values()) {
JToggleButton tgb = new JToggleButton();
tgb.setIcon(filter.getIcon());
tgb.setToolTipText(filter.getTooltip());
tgb.setFocusable(false);
tgb.setSelected(filter.isSelected());
tgb.addActionListener(this);
tgb.putClientProperty(TOOLBAR_FILTER, filter);
bg.add(tgb);
toolbar.add(tgb);
}
toolbar.setAlignmentX(LEFT_ALIGNMENT);
sectionPanel.add(toolbar);
sectionPanel.add(table);
sectionPanel.add(VCSCommitPanel.makeVerticalStrut(filesLabel, table, RELATED, sectionPanel));
sectionPanel.add(filesLabel);
sectionPanel.setAlignmentX(LEFT_ALIGNMENT);
filesLabel.setAlignmentX(LEFT_ALIGNMENT);
table.setAlignmentX(LEFT_ALIGNMENT);
}