Results 1 to 6 of 6
  1. #1
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default I Need Some Project Improvement Ideas

    So just as a fun little side project to help instill what I've learned in the past few chapters of my book I am making a notepad clone.

    I don't think its really finished yet, but it has very similar functionality to notepad. Right now I have the following menus and their sub trees.

    Java Code:
    +File
        -New
        -Save
        -Save As
        -Open
    
    +Font Size
        -5
        -6
        -7
        -8
        -9
        -10
        -12
        -14
        -16
        -18
        -20
        -22
        -24
    
    +Font Type
        -Sans Serif
        -Serif
        -Monospaced
        -Arial
        -Calibri
        -Courier New
    
    +Font Style
        -Plain
        -Bold
        -Italic
    Does anyone have any ideas on what I could add that would make it better?

    Right now I'm trying to make it resizeable, and from what I can find on the internet making a JTextArea resizeable on the window is rather long and tedious. If anyone has any ideas on how to accomplish this easier than a GridBagLayout I would be much obliged.
    Last edited by Dark; 06-21-2011 at 07:19 PM.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    You can switch from a jtextarea to a jtextpane, this will allow functionality like a text editor, however; it gets quite a bit more difficult.

    As to the resizing issue, what happens if you use a borderlayout? What components do you have besides the text area? The menu bar should stick to the top regardless if you use setJMenuBar.

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

    Default

    Quote Originally Posted by Dark View Post
    Right now I'm trying to make it resizeable, and from what I can find on the internet making a JTextArea resizeable on the window is rather long and tedious. If anyone has any ideas on how to accomplish this easier than a GridBagLayout I would be much obliged.
    What's long and tedious about it? I just threw together an example (put a JTextArea inside a JScrollPane in a JFrame) and it seems to work okay. What am I missing?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    @Sunde does a JTextPane allow individual formatting? Like bolding a selection instead of the whole thing?

    @KevinWorkman I want the JTextArea to be the same size as the window at all times. Right now I only have a JTextArea and a MenuBar, but since JTextArea's use columns and rows instead of pixels I have no idea on how to make a simple resizing method. The only one I could find on Google was a GridBoxLayout.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

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

    Default

    Quote Originally Posted by Dark View Post
    does a JTextPane allow individual formatting? Like bolding a selection instead of the whole thing?
    Have you read the API? Have you gone through the tutorial?

    Quote Originally Posted by Dark View Post
    I want the JTextArea to be the same size as the window at all times. Right now I only have a JTextArea and a MenuBar, but since JTextArea's use columns and rows instead of pixels I have no idea on how to make a simple resizing method. The only one I could find on Google was a GridBoxLayout.
    Don't try to make a 'simple resizing method' just use an appropriate layout manager.

    db

  6. #6
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    I haven't read anything about the JTextPane, the first time I heard of it is when Sunde mentioned it. Thus my question, however I will have to look more into it.

    Hmm, I added my JTextArea to a JPanel. Are you suggesting that if I use a BorderLayout instead of a FlowLayout it will simply adjust itself whenever I resize my window? Hmm, I didn't think about that. Off to try it out.

    EDIT: Thank you very much for the suggestion, I didn't even think about that. Using a BorderLayout would allow me to create a JTextArea without defining a specific set of columns and rows too. I can't believe I forgot about this, seeing as I learned about it right before IO streams and Buffers.
    Last edited by Dark; 06-21-2011 at 08:04 PM.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

Similar Threads

  1. Need Project Ideas
    By javaesh in forum New To Java
    Replies: 9
    Last Post: 05-24-2013, 03:56 PM
  2. Project ideas
    By shirshbansal in forum Networking
    Replies: 0
    Last Post: 05-18-2010, 12:51 PM
  3. Need ideas and help with my project
    By Otakon in forum New To Java
    Replies: 7
    Last Post: 01-28-2010, 09:49 PM
  4. Ideas for Java Project
    By mrbharatmehta in forum Advanced Java
    Replies: 11
    Last Post: 03-28-2009, 07:42 AM
  5. Any Ideas for a Project?
    By quddusaliquddus in forum Advanced Java
    Replies: 19
    Last Post: 12-19-2008, 04:22 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
  •