当前位置: 首页>>代码示例>>Java>>正文


Java JToolBar.setAlignmentX方法代码示例

本文整理汇总了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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:24,代码来源:TitledPanel.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:CollapsiblePanel.java


注:本文中的javax.swing.JToolBar.setAlignmentX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。