Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JComboBox

  1. #1
    Member
    Join Date
    Mar 2010
    Posts
    111
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Default JComboBox

    I have written the following code
    package test;
     
    import java.awt.BorderLayout;
     
    import javax.swing.JComboBox;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
     
    public class ViewEditSelection extends JPanel{
     
    	/**
    	 * @param args
    	 */
     
     
     
    	public  ViewEditSelection(){
    		super(new BorderLayout());
     
    		String[] List = { "View", "Edit" };
    		JComboBox ViewEdit = new JComboBox(List);
    		ViewEdit.setSelectedIndex(0);
     
    		add(ViewEdit, BorderLayout.PAGE_START);
     
    	}
    	 private static void createAndShowGUI() {
    	        //Create and set up the window.
    	        JFrame frame = new JFrame();
    	        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
    	        //Create and set up the content pane.
    	        JComponent newContentPane = new  ViewEditSelection();
    	        newContentPane.setOpaque(true); //content panes must be opaque
    	        frame.setContentPane(newContentPane);
     
    	        //Display the window.
    	        frame.pack();
    	        frame.setVisible(true);
    	 }
     
    	 public static void main(String[] args) {
     
    		 javax.swing.SwingUtilities.invokeLater(new Runnable() {
    	            public void run() {
    	                createAndShowGUI();
    	            }
    		 });
    	}
     
     
    }

    as you see the output is like the first attached file but I want it to be like the second one.Actually I want to hide the upper part. is it possible to do so ? and if yes, how?
    Attached Images Attached Images


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: JComboBox

    JFrame frame = new JFrame();
    frame.setUndecorated(true);

  3. The Following User Says Thank You to copeg For This Useful Post:

    nasi (April 29th, 2010)

Similar Threads

  1. Problem with reset on JComboBox
    By WorkingMan in forum AWT / Java Swing
    Replies: 4
    Last Post: April 25th, 2013, 12:19 PM
  2. Need Help with my JComboBox and Textfield
    By superawesome in forum AWT / Java Swing
    Replies: 1
    Last Post: November 10th, 2009, 12:15 PM
  3. JComboBox and Textfield
    By Nexusfactor in forum AWT / Java Swing
    Replies: 3
    Last Post: November 9th, 2009, 12:57 PM
  4. JComboBox doubt
    By rajaramesh.tadi in forum AWT / Java Swing
    Replies: 0
    Last Post: August 24th, 2009, 08:18 AM
  5. Replies: 4
    Last Post: May 27th, 2008, 01:20 PM

Tags for this Thread