Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4700351

JToolBar does not work as expected

    Details

    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      x86, sparc
    • OS:
      generic, linux, solaris_8, windows_2000, windows_xp
    • Verification:
      Verified

      Description



      Name: icR10030 Date: 06/11/2002


      Filed By : J2SE-SQA [###@###.###
      JDK : jdk1.4.1-b14
      JCK : jck1.4-b17
      Platform[s] : Windows 2000 Prof, Redhat Linux 7.2
      switch/Mode : -client -Xmixed -Xfuture
      JCK test owner : http://javaweb.eng/jck/usr/owners.jto
      Failing Test : api/javax_swing/interactive/JToolBarTests.html#JToolBar [JToolBarTest0004]

      jtr file location:
       ==================
      /net/jtgb4u4c.eng/export/sail15/results/hopper/b14/jck14/win32/win2000_client_linux-2/workDir/api-interactive/javax_swing/interactive/JToolBarTests_JToolBar.jtr

      Test source location:
      =====================
      /net/jdk/export/disk8/local.java//jck1.4/JCK-runtime-14/tests//api/javax_swing/interactive/JToolBarTests.java

      How to reproduce:
      ============
      1. Compile and run following class,
         buttons in toolbar are for changing orientation.
      2. Drag out toolbar
      3. Change orientation of toolbar to VERTICAL
      4. Try to drag toolbar again - orientation always changes to HORIZONTAL.
       

      //-------- class JToolBarTest ---------------------
      import javax.swing.JToolBar;
      import javax.swing.JButton;
      import javax.swing.ImageIcon;

      import javax.swing.JFrame;
      import javax.swing.JPanel;

      import java.awt.*;
      import java.awt.event.*;

      public class JToolBarTest extends JFrame {
              public JToolBarTest() {
                      super("ToolBarTest");
                      addWindowListener(new WindowAdapter() {
                          public void windowClosing(WindowEvent e) {
                              System.exit(0);
                          }
                      });

                      //Create the toolbar.
                      JToolBar toolBar = new JToolBar(javax.swing.SwingConstants.VERTICAL);
                      addButtons(toolBar);

                      //Lay out the content pane.
                      JPanel contentPane= new JPanel();
                      contentPane.setLayout(new BorderLayout());
                      contentPane.setPreferredSize(new Dimension(400, 100));
                      contentPane.add(toolBar, BorderLayout.NORTH);
                      setContentPane(contentPane);
              }

              protected void addButtons(final JToolBar toolBar) {
                      JButton button = null;

                      //first button
                      button = new JButton("VERTICAL");
                      button.addActionListener(new ActionListener() {
                              public void actionPerformed(ActionEvent e) {
                                      toolBar.setOrientation(javax.swing.SwingConstants.VERTICAL);
                              }
                      });
                      toolBar.add(button);

                      //second button
                      button = new JButton("HORIZONTAL");
                      button.addActionListener(new ActionListener() {
                              public void actionPerformed(ActionEvent e) {
                                      toolBar.setOrientation(javax.swing.SwingConstants.HORIZONTAL);
                              }
                      });
                      toolBar.add(button);
              }

              public static void main(String[] args) {
                      JToolBarTest frame = new JToolBarTest();
                      frame.pack();
                      frame.setVisible(true);
              }
      }
      //-------- END ---------------------

      Specific Machine Info:
      ======================
      Os: Windows 2000 Prof
      Hostname: linux-2
      Os: Redhat 7.2
      Hostname: linux-13


      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kereminsunw Konstantin Eremin (Inactive)
                Reporter:
                ichesunw Iche Iche (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: