Package javax.swing

Examples of javax.swing.Box


        }

        // - remove the settingPanel
        mainPanel2.remove(0);
       
        Box vb = Box.createVerticalBox();       
        Object userObject = node.getUserObject();
        if (userObject instanceof OptionPageProvider) {
            settingPanel = new OptionPageProviderPanel((OptionPageProvider) userObject, getProject(), getUIFacade());
        }
        else {

        // - ask the settingPanel if parameters are changed

        // - Create the new panel
            String sNode = (String) (node.getUserObject());
            if (sNode.equals(language.getText("languages")))
                settingPanel = new LanguageSettingsPanel(appli);
   
            else if (sNode.equals(GanttProject.correctLabel(language
                    .getText("project"))))
                settingPanel = new ProjectSettingsPanel((Frame) getOwner(),
                        getProject());
   
            else if (sNode.equals(GanttProject.correctLabel(language
                    .getText("parameters"))))
                settingPanel = new ParametersSettingsPanel(appli);
   
            else if (sNode.equals(GanttProject.correctLabel(language
                    .getText("resourceRole"))))
                settingPanel = new RolesSettingsPanel(appli);
   
            else if (sNode.equals(language.getText("looknfeel")))
                settingPanel = new LnFSettingsPanel(appli);
   
            else if (sNode.equals(GanttProject.correctLabel(language
                    .getText("export"))))
                settingPanel = new ExportSettingsPanel(appli);
   
            else if (sNode.equals("csv"))
                settingPanel = new CSVSettingsPanel(appli);
   
            else
                settingPanel = new WelcomeSettingsPanel(appli);
            vb.add(new TopPanel("  " + settingPanel.getTitle(), settingPanel
                    .getComment()));
        }   
        // - initialize the panel
        settingPanel.initialize();
        vb.add(settingPanel.getComponent());

        // - add the settingPanel into the main Panel
        mainPanel2.add(vb, 0);
        mainPanel2.repaint();
        mainPanel2.validate(); // valide the changes
View Full Code Here


    }

    public JComponent getComponent(Action[] choiceChangeActions, JComponent[] choiceComponents, int selectedGroupIndex) {
        myButtons = new AbstractButton[choiceChangeActions.length];
        myOptionComponents = new JComponent[choiceChangeActions.length];
        Box result = Box.createVerticalBox();
        myExporterToggles = new ButtonGroup();
        for (int i = 0; i < choiceChangeActions.length; i++) {
            final int selectedIndex = i;
            final Action nextRealAction = choiceChangeActions[i];
            Action nextWrapperAction = new AbstractAction(String
                    .valueOf(nextRealAction.getValue(Action.NAME))) {
                public void actionPerformed(ActionEvent e) {
                    nextRealAction.actionPerformed(e);
                    updateSelectionUI(selectedIndex);
                }
            };
            JRadioButton nextButton = new JRadioButton(nextWrapperAction);
            nextButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
            JPanel nextExporterPanel = new JPanel(new BorderLayout());
            nextExporterPanel.add(nextButton, BorderLayout.NORTH);
            myButtons[i] = nextButton;
            myExporterToggles.add(nextButton);
            JComponent nextOptionComponent = choiceComponents[i];
            myOptionComponents[i] = nextOptionComponent;
            nextOptionComponent.setBorder(BorderFactory.createEmptyBorder(
                    0, 30, 20, 0));
            nextExporterPanel.add(nextOptionComponent, BorderLayout.CENTER);
            setEnabledTree(nextOptionComponent, false);
            result.add(nextExporterPanel);
//            if (i == 0) {
//                nextButton.setSelected(true);
//            }
        }
        setSelected(selectedGroupIndex);
View Full Code Here

            new GPOptionGroup("", new GPOption[] {myStart, myFinish});
        group.setTitled(false);
        JComponent datesBox = builder.buildPlanePage(new GPOptionGroup[] {group});
        topPanel.add(datesBox, BorderLayout.CENTER);
      //
        Box buttonBox = Box.createHorizontalBox();
        buttonBox.setBorder(BorderFactory.createEmptyBorder(3,0,3,0));
        buttonBox.add(new JButton(myAddAction));
        buttonBox.add(Box.createHorizontalStrut(5));
        buttonBox.add(new JButton(myDeleteAction));
        topPanel.add(buttonBox, BorderLayout.SOUTH);
        topPanel.setBorder(BorderFactory.createEmptyBorder(5,5,0,5));
        add(topPanel, BorderLayout.NORTH);
        //
        JList list = new JList(myListModel);
View Full Code Here

                .correctLabel(GanttLanguage.getInstance().getText(
                        "saveToServer"))), true);

        JPanel inputPanel = new JPanel(new BorderLayout());

        Box serverBox = Box.createVerticalBox();
        serverBox.add(new JLabel(language.getText("fileFromServer")));
        String sDefaultURL = "http://ganttproject.sourceforge.net/tmp/testGantt.xml";
        urlField = new JTextField((null != currentURL) ? currentURL
                : sDefaultURL);
        serverBox.add(urlField);

        inputPanel.add(serverBox, BorderLayout.NORTH);

        Box hb = Box.createHorizontalBox(); // horizontal box

        Box ivbw = Box.createVerticalBox(); // inner vertical box west
        Box ivbe = Box.createVerticalBox(); // inner vertical box east

        ivbw.add(new JLabel(language.getText("userName")));
        userNameField = new JTextField(currentUser);
        ivbw.add(userNameField);

        ivbe.add(new JLabel(language.getText("password")));
        passwordField = new JPasswordField(currentPass);
        ivbe.add(passwordField);

        hb.add(ivbw);
        hb.add(ivbe);

        inputPanel.add(hb, BorderLayout.SOUTH);
View Full Code Here

        GanttLanguage language = GanttLanguage.getInstance();

        res = button;

        Box b1 = Box.createVerticalBox();

        if (msgtype == ERROR)
            b1.add(new JLabel(new ImageIcon(getClass().getResource(
                    "/icons/error.png"))));
        else if (msgtype == WARNING)
            b1.add(new JLabel(new ImageIcon(getClass().getResource(
                    "/icons/warning.png"))));
        else if (msgtype == INFO)
            b1.add(new JLabel(new ImageIcon(getClass().getResource(
                    "/icons/info.png"))));
        else if (msgtype == QUESTION)
            b1.add(new JLabel(new ImageIcon(getClass().getResource(
                    "/icons/question.png"))));

        getContentPane().add(b1, "West");

        Box b2 = Box.createVerticalBox();
        JTextArea textArea = new JTextArea(message);
        textArea.setEditable(false);
        textArea.setBackground(new JLabel().getBackground());
        b2.add(textArea);
        getContentPane().add(b2, "Center");

        JPanel p = new JPanel();
        // YES BUTTON
        JButton yes = new JButton((button == 0) ? language.getText("ok")
View Full Code Here

        // true);

        // setResizable(false);
        this.save = date.Clone();
        // month = date.getDayMonthLanguage();
        Box vb1 = Box.createVerticalBox();
        Box hb1 = Box.createHorizontalBox();

        jbPrevYear = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/prevyear.gif")));
        jbPrevYear.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                rollDate(Calendar.YEAR, -1);
            }
        });
        jbPrevMonth = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/prevmonth.gif")));
        jbPrevMonth.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                rollDate(Calendar.MONTH, -1);
            }
        });
        jbNextMonth = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/nextmonth.gif")));
        jbNextMonth.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                rollDate(Calendar.MONTH, +1);
            }
        });
        jbNextYear = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/nextyear.gif")));
        jbNextYear.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                rollDate(Calendar.YEAR, +1);
            }
        });

        jbPrevYear.setToolTipText(GanttProject.getToolTip(language
                .getText("prevYear")));
        jbPrevMonth.setToolTipText(GanttProject.getToolTip(language
                .getText("prevMonth")));
        jbNextMonth.setToolTipText(GanttProject.getToolTip(language
                .getText("nextMonth")));
        jbNextYear.setToolTipText(GanttProject.getToolTip(language
                .getText("nextYear")));

        ddd = new GanttDialogDateDay(date, language);
        jtDate = new JFormattedTextField(new SimpleDateFormat("MMM yyyy"));
        jtDate.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                GregorianCalendar tmp = new GregorianCalendar();
                tmp.setTime((Date) jtDate.getValue());
                changeDate(tmp);
            }
        });
        jtDate.setValue(ddd.date.getTime());
        jtDate.setEditable(false);
        hb1.add(jbPrevYear);
        hb1.add(jbPrevMonth);
        hb1.add(jtDate);
        hb1.add(jbNextMonth);
        hb1.add(jbNextYear);

        vb1.add(hb1);
        vb1.add(ddd);

        add(vb1, "Center");
View Full Code Here

            ButtonGroup group = new ButtonGroup();
            group.add(radioFalse);
            group.add(radioTrue);
            radioTrue.setSelected(true);
           
            Box box = Box.createVerticalBox();
            box.add(radioTrue);
            box.add(radioFalse);
            panelBoolean = box;
        }
        {
            // Integer
            fieldInteger = new GTextField();
            fieldInteger.setPattern(GTextField.PATTERN_INTEGER);
            fieldInteger.setColumns(10);
            fieldInteger.setText("0");
            panelInteger = new JPanel(new BorderLayout());
            panelInteger.add(fieldInteger, BorderLayout.NORTH);
        }
        {
            // Double
            fieldDouble = new GTextField();
            fieldDouble.setPattern(GTextField.PATTERN_DOUBLE);
            fieldDouble.setColumns(10);
            fieldDouble.setText("0.0");
            panelDouble = new JPanel(new BorderLayout());
            panelDouble.add(fieldDouble, BorderLayout.NORTH);
        }
        {
            panelDate = builder.createStandaloneOptionPanel(myDate);
            cardLayoutDefaultValue = new CardLayout();
            panelDefaultValue = new JPanel(cardLayoutDefaultValue);
            panelDefaultValue.add(cardText, panelText);
            panelDefaultValue.add(cardBoolean, panelBoolean);
            panelDefaultValue.add(cardInteger, panelInteger);
            panelDefaultValue.add(cardDouble, panelDouble);
            panelDefaultValue.add(cardDate, panelDate);
        }
       
        Component optionsComponent = builder.createGroupComponent(myOptionGroup);
       
       
        Box result = Box.createVerticalBox();
        result.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
        //result.setLayout(new BorderLayout());
        result.add(optionsComponent);
        result.add(Box.createVerticalStrut(10));
        result.add(builder.createGroupComponent(myDefaultValueOptionGroup));
        result.add(panelDefaultValue);
        setDefaultValuePanelEnabled(false);
        return result;
    } // TODO change the default value for custom columns.
View Full Code Here

        return southPanel;
    }

    private Box constructNamePanel() {
        Box box = Box.createVerticalBox();
        JPanel previousStatePanel;
        nameComboBox = new JComboBox();
        if (myPreviousStates.size() != 0) {
            previousStatePanel = new JPanel(new FlowLayout(FlowLayout.TRAILING,
                    30, 20));
            previousStateLabel = new JLabel(lang.getText("previousStates"));
            for (int i = 0; i < myPreviousStates.size(); i++)
                nameComboBox.addItem(((GanttPreviousState) myPreviousStates
                        .get(i)).getName());
            nameComboBox.setName("nameComboBox");
            nameComboBox.setSelectedIndex(-1);
            previousStatePanel.add(previousStateLabel);
            previousStatePanel.add(nameComboBox);
            box.add(previousStatePanel);
        }
        nameTextField = new JTextField(20);
        nameTextField.setText(defaultName + "_" + count);
        nameTextField.selectAll();
        JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 30,
                20));
        namePanel.add(nameTextField);
        box.add(namePanel);
        box
                .setBorder(new TitledBorder(new EtchedBorder(), lang
                        .getText("name")));
        return box;
    }
View Full Code Here

    public ConnectionPanel(GanttProject parent) {
        super(GanttProject.correctLabel(GanttLanguage.getInstance().getText(
                "openFromServer")), GanttLanguage.getInstance().getText(
                "settingsConnection"), parent);

        Box vbServer = Box.createVerticalBox();

        // url textfield
        JPanel urlPanel = new JPanel(new BorderLayout());
        urlPanel.add(new JLabel(language.getText("fileFromServer")),
                BorderLayout.WEST);
        // urlPanel.add(tfUrl = new JTextField(), BorderLayout.CENTER);
        // vb.add(urlPanel);
        // vb.add(new JPanel());
        vbServer.add(urlPanel);
        vbServer.add(tfUrl = new JTextField("http://"));
        vbServer.add(new JPanel());

        // login textfield
        JPanel loginPanel = new JPanel(new BorderLayout());
        loginPanel.add(new JLabel(language.getText("userName")),
                BorderLayout.WEST);
        /*
         * loginPanel.add(tfLogin = new JTextField(), BorderLayout.CENTER);
         * vb.add(loginPanel); vb.add(new JPanel());
         */
        vbServer.add(loginPanel);
        vbServer.add(tfLogin = new JTextField());
        vbServer.add(new JPanel());

        // password textfield
        JPanel passwordPanel = new JPanel(new BorderLayout());
        passwordPanel.add(new JLabel(language.getText("userName")),
                BorderLayout.WEST);
        /*
         * passwordPanel.add(tfPassword = new JPasswordField(),
         * BorderLayout.CENTER); vb.add(passwordPanel); vb.add(new JPanel());
         */
        vbServer.add(passwordPanel);
        vbServer.add(tfPassword = new JPasswordField());
        vbServer.add(new JPanel());

        JPanel serverPanel = new JPanel(new BorderLayout());
        serverPanel.add(vbServer, BorderLayout.NORTH);
        vb.add(serverPanel);

View Full Code Here

public class TopPanel extends JPanel {

    /** Constructor. */
    public TopPanel(String title, String comment) {
        setLayout(new BorderLayout());
        Box vb = Box.createVerticalBox();
        add(vb, BorderLayout.CENTER);

        final int iWidth = 420;

        // Paint a gray border around the panel
        JPanel topPanel = new JPanel(new BorderLayout()) {
            public void paint(Graphics g) {
                super.paint(g);
                g.setColor(new Color(0.67f, 0.66f, 0.6f));
                g.drawRect(0, 0, getWidth() - 1, 24);
            }
        };
        topPanel.setBackground(Color.white);

        JLabel labelTitle = new JLabel(" " + title);
        labelTitle.setFont(new Font(this.getFont().getFontName(), Font.BOLD,
                this.getFont().getSize()));
        topPanel.add(labelTitle, BorderLayout.WEST);
        topPanel.add(new myIconPanel(), BorderLayout.EAST);
        topPanel.setPreferredSize(new Dimension(iWidth, 26));

        vb.add(topPanel);
        JTextArea textArea = new JTextArea(comment);
        textArea.setEditable(false);
        textArea.setDragEnabled(false);
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        textArea.setMargin(new Insets(3, 5, 3, 5));
        textArea.setBackground(getBackground());
        vb.add(textArea);

        // vb.setBorder(LineBorder.createBlackLineBorder());
        applyComponentOrientation(GanttLanguage.getInstance()
                .getComponentOrientation());
    }
View Full Code Here

TOP

Related Classes of javax.swing.Box

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.