Results 1 to 8 of 8

Thread: Shifting components in a JToolBar?

Threaded View

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resolved Shifting components in a JToolBar?

    I created a JToolBar that i eventually want to use in an application. When i hook the JToolBar into one of my apps the Buttons dont seem to line up right. I want to shift them over but nothing seems to work. Any ides on how i can do this?
    Code:
      import java.io.*;  
      import java.awt.*; 
      import javax.swing.*; 
      import java.awt.event.*; 
    
      public class ToolBar extends JToolBar{
        JButton redo;  
        JButton refresh; 
        JButton help;
        
        public ToolBar(){
        setFloatable(false);
         
         redo = new JButton(); 
         redo.setIcon(new ImageIcon("C:" +
            File.separator + "JavaLFGraphicsRepository" + File.separator + "toolbarButtonGraphics"
             + File.separator + "general" + File.separator + "Redo24.gif"));
                redo.setToolTipText("Update Database"); 
         
         refresh  = new JButton();
         refresh.setIcon(new ImageIcon("C:" +
            File.separator + "JavaLFGraphicsRepository" + File.separator + "toolbarButtonGraphics"
             + File.separator + "general" + File.separator + "Refresh.24.gif"));
                refresh.setToolTipText("Refresh Table");
     
         help = new JButton(); 
         help.setIcon(new ImageIcon("C:" +
            File.separator + "JavaLFGraphicsRepository" + File.separator + "toolbarButtonGraphics"
             + File.separator + "general" + File.separator + "Help24.gif"));
                help.setToolTipText("Help");    
      
         //add(Box.createVerticalStrut(1)); // Pushes buttons all the way over to the right.
         //addSeparator(new Dimension(0,100)); // does nothing 
         add(help); 
         add(redo);
         add(refresh); 
         
        }   
       }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width