Results 1 to 11 of 11
Like Tree1Likes
  • 1 Post By prabhdsun

Thread: Figuring out how to create whitespace

  1. #1
    prabhdsun is offline Member
    Join Date
    Dec 2012
    Posts
    22
    Rep Power
    0

    Default Figuring out how to create whitespace

    Here is what i am trying to figure out what to do. I cant attach a picture for some reason as i get grey space whenever i do manage attachments. i have started the gui and here is some of my gui code
    Java Code:
    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    	transactiondetailsPanel = new JPanel();
    	TitledBorder Titled4 = BorderFactory.createTitledBorder("Transaction Details");
    	location= new JLabel("Location ");
    	date= new JLabel("Date MM/DD/YYYY");
    	payee = new JLabel();
    	TF2 = new JTextField(10);
    	TF3 = new JTextField(10);
    	TF4 = new JTextField(10);
    	payee.setVisible(false);
    	TF4.setVisible(false);
    	transactiondetailsPanel.setBorder(Titled4);
    	transactiondetailsPanel.add(location);
    	transactiondetailsPanel.add(TF2);
    	transactiondetailsPanel.add(date);
    	transactiondetailsPanel.add(TF3);
    	transactiondetailsPanel.add(payee);
    	transactiondetailsPanel.add(TF4);
    	add(transactiondetailsPanel);
    	
    	// Fifth Panel
    	
    	this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    	transactionlistPanel = new JPanel();
    	TitledBorder Titled5 = BorderFactory.createTitledBorder("Transaction Details");
    The problem i am having is on the fifth panel, im suppose to have a giant space which is white, somehow using a JList or jtable, to which information will be added based on transactions made from a bank account. So for example, if i deposit some money and click on the update button i will create, the giant whitespace will show this on it " Date:......... Transaction.... Money..... " All in one line. How do i do this?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,956
    Rep Power
    8

    Default Re: Figuring out how to create whitespace

    I'm really not sure what you're asking. Recommended reading: Lesson: Using Swing Components (The Java™ Tutorials > Creating a GUI With JFC/Swing)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    prabhdsun is offline Member
    Join Date
    Dec 2012
    Posts
    22
    Rep Power
    0

    Default Re: Figuring out how to create whitespace

    yeh thats the problem im having, i dont know how to put in words what im asking for. huh ok let me put it this way. You know when you start a word document, you have a blank page, a white space right??? well basically im trying to put that sort of "blank page" in a panel, where just the space shows up, and nothing else. does this explain it?

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,956
    Rep Power
    8

    Default Re: Figuring out how to create whitespace

    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    milovan is offline Senior Member
    Join Date
    Jan 2011
    Location
    Belgrade, Serbia
    Posts
    301
    Rep Power
    4

    Default Re: Figuring out how to create whitespace

    Also check out JEditorPane and JTextPane.

  6. #6
    prabhdsun is offline Member
    Join Date
    Dec 2012
    Posts
    22
    Rep Power
    0

    Default Re: Figuring out how to create whitespace

    Appreciate both you guys's help, but our teacher in this assignment is testing on JList or JTable and we havent used JEditorPane and jTextPane before. You know when you want to reply to an answer on this forum, you type in a white box, thats the sort of white box i want, except i want it to be uneditable because it will show transactions that the person makes using buttons on panel and all that, and it shouldnt be user editable. Could this be done somehow by JList or JTable?

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,956
    Rep Power
    8

    Default Re: Figuring out how to create whitespace

    If you want to be able to type, that's a text component like we mentioned.

    If you just want to set the initial size of a JList, that's a layout manager, which is also listed above.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,002
    Rep Power
    20

    Default Re: Figuring out how to create whitespace

    It's not typing, by the sound of it.
    prabhdsun will correct me I'm sure, but it sound like an area of the screen displaying the track record of what's gone on in the application.
    So, to take the example:
    deposit money into the bank account -> this "area" will display the transaction
    withdraw some money -> append that transaction to the "area".

    A JList would be easiest, as you could simply concatenate a String together representing the transaction and add it as an entry in the list.
    Swing would do the rest.
    A JTable would give a better layout, but may involve more work to get it to display properly.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    prabhdsun is offline Member
    Join Date
    Dec 2012
    Posts
    22
    Rep Power
    0

    Default Re: Figuring out how to create whitespace

    Tolls, that is exactly what i need!!!!!. Could you please give me a hint as to how to do it. I want my transactions of depositing, withdrawing, being shown on the white space that i figured out how to create :D!!

  10. #10
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default Re: Figuring out how to create whitespace

    Quote Originally Posted by prabhdsun View Post
    Could you please give me a hint as to how to do it.
    Tolls has already given you a hint. You've also been given three links to the Swing tutorials. Did you take the trouble to scout around to see what else you might find there?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  11. #11
    prabhdsun is offline Member
    Join Date
    Dec 2012
    Posts
    22
    Rep Power
    0

    Default Re: Figuring out how to create whitespace

    Yes i did, oh lol just read it again, i think i might know what to do now, will get back to you :D
    DarrylBurke likes this.

Similar Threads

  1. Check if a string contains whitespace characters
    By Pojahn_M in forum New To Java
    Replies: 1
    Last Post: 03-08-2012, 09:16 PM
  2. How to increase whitespace?
    By Cylab in forum New To Java
    Replies: 4
    Last Post: 08-09-2010, 08:00 PM
  3. Replies: 2
    Last Post: 03-31-2010, 12:26 AM
  4. removing duplicate whitespace
    By loki in forum New To Java
    Replies: 1
    Last Post: 04-25-2009, 05:54 PM
  5. Reproducing whitespace with DOM
    By doofuslarge in forum XML
    Replies: 1
    Last Post: 02-11-2009, 01:42 PM

Posting Permissions

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