Package javax.swing

Examples of javax.swing.Box


       
        JPanel main = new JPanel();
        main.setBorder( new EmptyBorder( 10, 20, 10, 20 ) );
       
        this.setResizable( false );
        Box b = Box.createVerticalBox();
        b.add( Box.createGlue() );
        b.add( new JLabel( DemoApp.getRes().getString("Demo Application for the Java Service Wrapper" ) ) );
        b.add( new JLabel( "By Tanuki Software Ltd." ) );
        final JLabel url = new JLabel();
        url.setText( "<html><u>http://wrapper.tanukisoftware.com</u></html>" );
        url.setForeground( Color.BLUE );
        url.addMouseListener( new MouseListener()
        {

            public void mouseReleased( MouseEvent e )
            {
                // TODO Auto-generated method stub
            }

            public void mousePressed( MouseEvent e )
            {
                // TODO Auto-generated method stub
            }

            public void mouseExited( MouseEvent e )
            {
                url.setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
            }

            public void mouseEntered( MouseEvent e )
            {
                url.setCursor( new Cursor( Cursor.HAND_CURSOR ) );
            }

            public void mouseClicked( MouseEvent e )
            {

                if ( e.getClickCount() > 0 )
                {
                    String url = "http://wrapper.tanukisoftware.com";
                    String cmd;
                    if ( WrapperManager.isWindows() )
                    {
                        cmd = "cmd.exe /c start " + url;
                    }
                    else if ( WrapperManager.isMacOSX() )
                    {
                        cmd = "open " + url;
                    }
                    else
                    {
                        cmd = "firefox " + url;
                    }
                   
                    try
                    {
                        Runtime.getRuntime().exec( cmd );
                    }
                    catch ( IOException ex )
                    {
                        System.out.println( DemoApp.getRes().getString( "Failed to launch external browser to view web page using command:" ) );
                        System.out.println( "    " + cmd );
                        System.out.println( DemoApp.getRes().getString("  Error: ") + ex.getMessage() );
                        System.out.println();
                        System.out.println( DemoApp.getRes().getString( "Please enter URL into your browser: " ) + url );
                        System.out.println();
                    }
                }

            }
        } );

        b.add( url );
        b.add( Box.createGlue() );
        main.add( b, "Center" );

        JPanel p2 = new JPanel();
        JButton ok = new JButton( "Ok " );
        p2.add( ok );
View Full Code Here


        //  uses a CardLayout layout manager to display multiple panels in the
        //  same spot.
       
        JPanel buttonPanel = new JPanel();
        JSeparator separator = new JSeparator();
        Box buttonBox = new Box(BoxLayout.X_AXIS);

        cardPanel = new JPanel();
        cardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));      

        cardLayout = new CardLayout();
        cardPanel.setLayout(cardLayout);
       
        backButton = new JButton();
        nextButton = new JButton();
        cancelButton = new JButton();
       
        backButton.setActionCommand(BACK_BUTTON_ACTION_COMMAND);
        nextButton.setActionCommand(NEXT_BUTTON_ACTION_COMMAND);
        cancelButton.setActionCommand(CANCEL_BUTTON_ACTION_COMMAND);

        backButton.addActionListener(wizardController);
        nextButton.addActionListener(wizardController);
        cancelButton.addActionListener(wizardController);
       
        //  Create the buttons with a separator above them, then place them
        //  on the east side of the panel with a small amount of space between
        //  the back and the next button, and a larger amount of space between
        //  the next button and the cancel button.
       
        buttonPanel.setLayout(new BorderLayout());
        buttonPanel.add(separator, BorderLayout.NORTH);

        buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));      
        buttonBox.add(backButton);
        buttonBox.add(Box.createHorizontalStrut(10));
        buttonBox.add(nextButton);
        buttonBox.add(Box.createHorizontalStrut(30));
        buttonBox.add(cancelButton);
       
        buttonPanel.add(buttonBox, java.awt.BorderLayout.EAST);
       
        wizardDialog.getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH);
        wizardDialog.getContentPane().add(cardPanel, java.awt.BorderLayout.CENTER);
View Full Code Here

    ++cons.gridx;
    cons.weightx = 1.0f;
    if (extra != null)
    {
      Box box = Box.createHorizontalBox();
      box.add(rightComp);
      box.add(extra);
      _layout.setConstraints(box, cons);
      add(box);
    }
    else
    {
View Full Code Here

    parameterAction = new ParameterDialogAction();
    getButtonPanel().add(Builder.createButton(parameterAction), 0);
  }

  protected void addNumberTextField() {
    Box box = Box.createHorizontalBox();

    addressBookAction = new AddressBookAction();
   
    numberTextField = new JTextField();
    numberTextField.setMaximumSize(new Dimension(Integer.MAX_VALUE, numberTextField.getPreferredSize().height));
    numberTextField.setTransferHandler(new ContactTransferHandler());
    //numberTextField.setDragEnabled(true);
    box.add(numberTextField);
    box.add(Box.createHorizontalStrut(4));
    box.add(Builder.createIconButton(addressBookAction));
    numberLabel = builder.append("", box, 4);
    builder.nextLine();

    numberCompletionModel = new DefaultCompletionModel();
    numberCompletion = Builder.addCompletion(numberTextField, numberCompletionModel);
View Full Code Here

    jPanel2.add(Box.createHorizontalGlue());


    jPanel1.add(jPanel3Insertion);

    Box resizablePanel1 = new Box(BoxLayout.X_AXIS);
    //resizablePanel1.setMaximumSize(new java.awt.Dimension(2000, 300));
    //resizablePanel1.setPreferredSize(new Dimension(541,300));
    //  resizablePanel1.add(jPanel1);
    resizablePanel1.add(Box.createVerticalStrut(200));
    mainSplitPane.setRightComponent(jPanel1);

    //  jToolBar3.add(jp5ConsolePane);
    getContentPane().add(jp5ConsolePane,BorderLayout.SOUTH);
View Full Code Here

        publicHolidayPanel.add(choosePublicHoliday, BorderLayout.WEST);
        publicHolidayPanel.add(JCCalendar);
        myBox.add(publicHolidayPanel);
        myBox.add(new JPanel());

        Box cb = Box.createVerticalBox();
        /*
         * Table to keep all the JCheckBoxes with days of the week.
         * It is used to check if in project creation dialog all days are marked as weekend. If they are, day selected
         * last will be unmarked. See class CheckBoxAction.
         *
         * If you know better solution, do not hesitate to replace this code.
         */
        JCheckBox[] allCheckBoxes = new JCheckBox[7];
        cb.add(chooseWeekend);
        int nextDay = Calendar.MONDAY;
        for (int i = 0; i < 7; i++) {
            JCheckBox nextCheckBox = new JCheckBox();
            nextCheckBox
                    .setSelected(calendar.getWeekDayType(nextDay) == GPCalendar.DayType.WEEKEND);
            nextCheckBox.setAction(new CheckBoxAction(nextDay,
                    dayNames[nextDay - 1], nextCheckBox.getModel(), allCheckBoxes));
            cb.add(nextCheckBox);
            allCheckBoxes[i] = nextCheckBox;
            if (++nextDay >= 8) {
                nextDay = 1;
            }
        }
View Full Code Here

    public String getTitle() {
        return myI18N.getProjectDomainPageTitle();
    }

    public Component getComponent() {
        Box domainBox = new Box(BoxLayout.PAGE_AXIS);
        JLabel label = new JLabel(GanttLanguage.getInstance().getText(
                "chooseRoleSets"));

        final JList roleSetsList = new JList(myListModel);
        roleSetsList.setCellRenderer(myListModel.getCellRenderer());
        roleSetsList.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                int index = roleSetsList.locationToIndex(e.getPoint());
                myListModel.toggle(index);
            }
        });
        roleSetsList.setAlignmentX(0);
        label.setLabelFor(roleSetsList);
        label.setAlignmentX(0);

        domainBox.add(label);
        domainBox.add(Box.createVerticalStrut(5));
        domainBox.add(roleSetsList);
        //
        JPanel result = new JPanel(new BorderLayout());
        result.add(domainBox, BorderLayout.CENTER);
        // result.setBorder(LineBorder.createBlackLineBorder());
        return result;
View Full Code Here

        list.setName("list");
        scrollPane = new JScrollPane(list);
        scrollPane.setPreferredSize(new Dimension(110, 200));
        currentPanel.add(scrollPane, BorderLayout.EAST);

        Box currentButtonBox = Box.createVerticalBox();
        Box deletedButtonBox = Box.createVerticalBox();

        JButton bUp = new JButton();
        bUp.setIcon(new ImageIcon(getClass().getResource("/icons/up_16.gif")));
        bUp.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("upTask"))));
        bUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                upButtonActionPerformed(evt);
            }
        });

        JButton bDown = new JButton();
        bDown.setIcon(new ImageIcon(getClass()
                .getResource("/icons/down_16.gif")));
        bDown.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("downTask"))));
        bDown.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                downButtonActionPerformed(evt);
            }
        });

        JButton bSeparator = new JButton();
        bSeparator.setIcon(new ImageIcon(getClass().getResource(
                "/icons/separator_16.gif")));
        bSeparator.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("separator"))));
        bSeparator.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                separatorButtonActionPerformed(evt);
            }
        });

        JButton bDelete = new JButton();
        bDelete.setIcon(new ImageIcon(getClass().getResource(
                "/icons/indent_16.gif")));
        bDelete.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("delete"))));
        bDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteButtonActionPerformed(evt);
            }
        });
        JButton bAdd = new JButton();
        bAdd.setIcon(new ImageIcon(getClass().getResource(
                "/icons/unindent_16.gif")));
        bAdd.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("add"))));
        bAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addButtonActionPerformed(evt);
            }
        });

        currentButtonBox.add(new JPanel());
        currentButtonBox.add(new JPanel());
        currentButtonBox.add(bUp);
        currentButtonBox.add(new JPanel());
        currentButtonBox.add(bDown);
        currentButtonBox.add(new JPanel());
        currentButtonBox.add(new JPanel());
        deletedButtonBox.add(new JPanel());
        deletedButtonBox.add(new JPanel());
        deletedButtonBox.add(bAdd);
        deletedButtonBox.add(new JPanel());
        deletedButtonBox.add(bDelete);
        deletedButtonBox.add(new JPanel());
        deletedButtonBox.add(new JPanel());

        positionPanel.add(currentButtonBox);
        positionPanel.add(currentPanel);
        positionPanel.add(new JPanel());
        positionPanel.add(deletedButtonBox);
View Full Code Here

        myParentComponent = parentComponent;
        initComponents();
    }

    public TextFieldAndFileChooserComponent(String label, String dialogCaption) {
        Box innerBox = Box.createHorizontalBox();
        innerBox.add(new JLabel(label));
        innerBox.add(Box.createHorizontalStrut(2));
        myParentComponent = innerBox;
        myDialogCaption = dialogCaption;
        initComponents();
        innerBox.add(myComponent);
        myComponent = innerBox;
    }
View Full Code Here

        myChooserButton = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/open_16.gif")));
        myTextField = new JTextField();
        myTextField.setColumns(40);
        myTextField.setEditable(false);
        Box box = Box.createHorizontalBox();
        box.add(myTextField);
        box.add(myChooserButton);
        myComponent = box;
        myChooserButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                showFileChooser();
            }
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.