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

The following are Jave code examples for showing how to use setLayout() 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: incubator-netbeans   File: DefaultPlugin.java   View Source Code Vote up 6 votes
/**
 */
private static JComponent wrapDialogContent(JComponent comp,
                                            boolean selfResizing) {
    JComponent result;
    
    if ((comp.getBorder() != null) || selfResizing) {
        result = selfResizing ? new SelfResizingPanel() : new JPanel();
        result.setLayout(new GridLayout());
        result.add(comp);
    } else {
        result = comp;
    }
    result.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
    result.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_title_select_generator"));
    return result;
}
 
Example 2
Project: incubator-netbeans   File: ViewModelListener.java   View Source Code Vote up 6 votes
ViewModelListener(
    String viewType,
    JComponent view,
    JComponent buttonsPane,
    String propertiesHelpID,
    Image viewIcon
) {
    this.viewType = viewType;
    this.view = view;
    this.buttonsPane = buttonsPane;
    buttonsPane.setLayout(new GridBagLayout());
    this.propertiesHelpID = propertiesHelpID;
    this.viewIcon = viewIcon;
    initView();
    setUp();
}
 
Example 3
Project: incubator-netbeans   File: AbstractViewTabDisplayerUI.java   View Source Code Vote up 5 votes
@Override
public void installUI(JComponent c) {
    super.installUI(c);
    ToolTipManager.sharedInstance().registerComponent(displayer);
    controller = createController();
    dataModel = displayer.getModel();
    dataModel.addChangeListener (controller);
    dataModel.addComplexListDataListener(controller);
    layoutModel = createLayoutModel();
    if( !Boolean.getBoolean("winsys.non_stretching_view_tabs") && !isUseStretchingTabs() ) {
        btnMinimizeMode = TabControlButtonFactory.createSlideGroupButton( displayer );
        c.setLayout( new PinButtonLayout() );
    }
    displayer.addPropertyChangeListener (controller);
    selectionModel.addChangeListener (controller);
    displayer.addMouseListener(controller);
    displayer.addMouseMotionListener(controller);
    installControlButtons();
    dataModel.addChangeListener( new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            showHideControlButtons();
            if( null != dataModel )
                dataModel.removeChangeListener( this );
        }
    });
    showHideControlButtons();
}
 
Example 4
Project: incubator-netbeans   File: EmptyTestStepLocation.java   View Source Code Vote up 5 votes
private Component createVisualComp() {
    JCheckBox[] chkBoxes;
    
    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 box = new SelfResizingPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
    box.add(optCode);
    box.add(Box.createHorizontalStrut(18));
    box.add(optComments);

    /* tune layout of the components within the box: */
    optCode.setAlignmentY(0.0f);
    optComments.setAlignmentY(0.0f);

    return box;
}
 
Example 5
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;
}