Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: gm110360 Date: 07/17/2002


      FULL PRODUCT VERSION :
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      1. While dragging JToolBar repainted jast as gray
      rectangle (DragWindow) - there is really no reason for it.
      2. DragWindw constructor is not public so I can't change
      it behavior.
      3. If JToolBar dragged outside of its owner you put him in
      Frame and make it HORIZONTAL. What is if I need VERTICAL
      (always VERTICAL) JToolBar?. Why don't use a Window for
      it? You have already DragWindow and if you properly
      repaint it you may just leave JToolBar in DragWindow.
      4. VERTICAL JToolBar should stay VERTICAL.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Wenn you start it you can see that JToolBar looks really
      wrong - VERTICAL but at NORTH side.
      2.Drag it outside of Window
      3.While dragging it shown as gray rectangle
      3.Drop it.
      4. Now it is HORIZONTAL and lie in a Frame

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      1. I expect that VERTICAL JToolBar can float only to WEST
      or EAST side. Actually it can float at any side.
      2. VERTICAL JToolBar should stay VERTICAL.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      //Your own ToolBarDemo - slitly modified

      import javax.swing.JToolBar;
      import javax.swing.JButton;
      import javax.swing.ImageIcon;

      import javax.swing.JFrame;
      import javax.swing.JTextArea;
      import javax.swing.JScrollPane;
      import javax.swing.JPanel;

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

      public class ToolBarDemo extends JFrame {
          protected JTextArea textArea;
          protected String newline = "\n";

          public ToolBarDemo() {
              //Do frame stuff.
              super("ToolBarDemo");
              addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });

              //Create the toolbar.
              JToolBar toolBar = new JToolBar(JToolBar.VERTICAL);
      toolBar.setRollover(true);
              addButtons(toolBar);

              //Create the text area used for output.
              textArea = new JTextArea(5, 30);
              JScrollPane scrollPane = new JScrollPane(textArea);

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

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

              //first button
              button = new JButton(new ImageIcon("images/left.gif"));
              button.setToolTipText("This is the left button");
              button.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      displayResult("Action for first button");
                  }
              });
              toolBar.add(button);

              //second button
              button = new JButton(new ImageIcon("images/middle.gif"));
              button.setToolTipText("This is the middle button");
              button.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      displayResult("Action for second button");
                  }
              });
              toolBar.add(button);

              //third button
              button = new JButton(new ImageIcon("images/right.gif"));
              button.setToolTipText("This is the right button");
              button.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      displayResult("Action for third button");
                  }
              });
              toolBar.add(button);
          }

          protected void displayResult(String actionDescription) {
              textArea.append(actionDescription + newline);
          }

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

      ---------- END SOURCE ----------
      (Review ID: 159458)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kereminsunw Konstantin Eremin (Inactive)
                Reporter:
                gmanwanisunw Girish Manwani (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: