We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Need help with frame design and layout

Hi Sorry i was doing a little program and i need helps
i would like to something similar to that
http://i42.tinypic.com/2mys23d.png

this is my code so far

private void makeFrame()
    {
        frame = new JFrame("Jubilee Estate Agency Property");
        makeMenuBar(frame);
        Container contentPane = frame.getContentPane();

        JLabel label = new JLabel();
        contentPane.add(label);

        // building is done - arrange the components and show        
        frame.pack();
        frame.setVisible(true);

        // Specify the layout manager with nice spacing
        contentPane.setLayout(new BorderLayout(2, 2));

        statusLabel = new JLabel(CONTACT);
        contentPane.add(statusLabel, BorderLayout.SOUTH);
    
        frame.pack();
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation(d.width/2 - frame.getWidth()/2, d.height/2 - frame.getHeight()/2);
        frame.setVisible(true);

and i would like know how I can put my code into a pop window and how i can do a list of something i have no idea.
thanks you I am a beginner in java

3
Contributors
6
Replies
4 Days
Discussion Span
1 Year Ago
Last Updated
7
Views
djescobar
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Hi Sorry i was doing a little program and i need helps
i would like to something similar to that
http://i42.tinypic.com/2mys23d.png

this is my code so far

private void makeFrame()
    {
        frame = new JFrame("Jubilee Estate Agency Property");
        makeMenuBar(frame);
        Container contentPane = frame.getContentPane();

        JLabel label = new JLabel();
        contentPane.add(label);

        // building is done - arrange the components and show        
        frame.pack();
        frame.setVisible(true);

        // Specify the layout manager with nice spacing
        contentPane.setLayout(new BorderLayout(2, 2));

        statusLabel = new JLabel(CONTACT);
        contentPane.add(statusLabel, BorderLayout.SOUTH);
    
        frame.pack();
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation(d.width/2 - frame.getWidth()/2, d.height/2 - frame.getHeight()/2);
        frame.setVisible(true);

and i would like know how I can put my code into a pop window and how i can do a list of something i have no idea.
thanks you I am a beginner in java

1.I would suggest you use the Grid Layout
2. For the menu bar : http://www.java2s.com/Tutorial/Java/0240__Swing/CreatingJMenuBarComponents.htm
3. for the image :

JLabel pic1;
    JLabel pic1 = new JLabel("",JLabel.LEFT);
    pic1.setIcon(new ImageIcon("300.jpg"));
con.add(pic1);
 pic1.setBounds(0,0,903,763);
TIM_M_91
Junior Poster in Training
83 posts since Feb 2012
Reputation Points: 18
Solved Threads: 0
Skill Endorsements: 0

@TIM_M_91 great suggestion +1, but remove code line (from your answer)

pic1.setBounds(0,0,903,763);

then you'll k*i*l*l used GridLayout

mKorbel
Nearly a Posting Virtuoso
1,215 posts since Feb 2011
Reputation Points: 482
Solved Threads: 239
Skill Endorsements: 12

done it thanks guys i really appreciate it.
I would like to ask you another question .
I want to do a list of property but don't how to do it I just know I have to use picklist . and also a pop window (For sale check the picture in my previous message) that has a search bar with several option (number of bedroom ,location etc..) and i would like to link between them as well

djescobar
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

done it thanks guys i really appreciate it.
I would like to ask you another question .
I want to do a list of property but don't how to do it I just know I have to use picklist . and also a pop window (For sale check the picture in my previous message) that has a search bar with several option (number of bedroom ,location etc..) and i would like to link between them as well

If I understand correctly for your list easiest way is to use a array combobox if you are not connecting to a database check out :

http://www.roseindia.net/java/example/java/swing/AddRemoveItemFromCombo.shtml

2. Can you confirm that you want this: For you search bar when you click on an item it displays the correct information?

If so you just need to adapted the code in the link above. If that isn't what you wanted can you explain it a bit better

TIM_M_91
Junior Poster in Training
83 posts since Feb 2012
Reputation Points: 18
Solved Threads: 0
Skill Endorsements: 0

Yes the combobox will be good and for my search bar is exactly what i want but which line a have to modifier


PS sorry for my English I'm french.

djescobar
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I did the combo box thanks to you .When i hit the add button i want to display a pop window that have different type properties(number of the room , type of property,price etc..)

djescobar
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0853 seconds using 2.86MB