Java Code Examples for javax.swing.JComponent.setAlignmentX()

The following are Jave code examples for showing how to use setAlignmentX() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jaer   File: PotPanel.java   View Source Code Vote up 5 votes
/** builds the panel of pots */
    private void buildPanel() {
        IPotSliderTextControl.allInstances.clear();
        potList=new ArrayList<Pot>(pots.getPots());
        componentList=new ArrayList<JComponent>();
        Collections.sort(potList, new PotDisplayComparator());
        potsPanel=new JPanel();
        potsPanel.setAlignmentX(RIGHT_ALIGNMENT);
        potsPanel.getInsets().set(0, 0, 0, 0);
        potsPanel.setLayout(new BoxLayout(potsPanel, BoxLayout.Y_AXIS));
        scrollPane=new JScrollPane(potsPanel);
        add(new PotSorter(componentList, potList));
        add(scrollPane);
        for(Pot p : potList) {
            JComponent s=p.makeGUIPotControl(); // make a bias control gui component
            s.setAlignmentX(RIGHT_ALIGNMENT);
            potsPanel.add(s);
            componentList.add(s);
            addBorderSetter(s);
        }
        potsPanel.add(Box.createVerticalGlue());
//        JPanel fillPanel=new JPanel();
//        fillPanel.setMinimumSize(new Dimension(0, 0));
//        fillPanel.setPreferredSize(new Dimension(0, 0));
//        fillPanel.setMaximumSize(new Dimension(32767, 32767));
//        potsPanel.add(fillPanel); // spacer at bottom so biases don't stretch out too much
    }
 
Example 2
Project: incubator-netbeans   File: CollapsiblePanel.java   View Source Code Vote up 4 votes
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);
}
 
Example 3
Project: incubator-netbeans   File: TestSuiteStepLocation.java   View Source Code Vote up 4 votes
private Component createVisualComp() {
    JCheckBox[] chkBoxes;
    
    JComponent infoLabel = GuiUtils.createMultilineLabel(
            NbBundle.getMessage(TestSuiteStepLocation.class,
                                "TXT_ClassesInSuite"));             //NOI18N
    JComponent optCode = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptCode"),               //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_SETUP,
                    GuiUtils.CHK_TEARDOWN,
                    GuiUtils.CHK_BEFORE_CLASS,
                    GuiUtils.CHK_AFTER_CLASS}));
    chkSetUp = chkBoxes[0];
    chkTearDown = chkBoxes[1];
    chkBeforeClass = chkBoxes[2];
    chkAfterClass = chkBoxes[3];
    
    JComponent optComments = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptComments"),           //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_HINTS}));
    chkCodeHints = chkBoxes[0];

    JComponent bottomPanel = new SelfResizingPanel();
    bottomPanel.setLayout(new BorderLayout(0, 24));
    bottomPanel.add(infoLabel, BorderLayout.NORTH);
    JComponent box = new JPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
    box.add(optCode);
    box.add(Box.createHorizontalStrut(18));
    box.add(optComments);
    bottomPanel.add(box, BorderLayout.CENTER);
    
    /* tune layout of the components within the box: */
    infoLabel.setAlignmentX(0.0f);
    optCode.setAlignmentY(0.0f);
    optComments.setAlignmentY(0.0f);
 
    return bottomPanel;
}
 
Example 4
Project: geomapapp   File: SurveyPlannerSelector.java   View Source Code Vote up 4 votes
/**
 * align the component to the left side of the panel
 * @param comp
 */
void alignComponent(JComponent comp) {
	comp.setAlignmentX(Component.LEFT_ALIGNMENT);
	comp.setPreferredSize(compDim);
	comp.setMaximumSize(compDim);
}
 
Example 5
Project: geomapapp   File: MGGSelector.java   View Source Code Vote up 4 votes
void alignComponent(JComponent comp) {
	comp.setAlignmentX(Component.LEFT_ALIGNMENT);
	comp.setPreferredSize(compDim);
	comp.setMaximumSize(compDim);
}