#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2006
    Posts
    100
    Rep Power
    14

    TitledBorder color in Netbeans


    How can I change the color of the line that surrounds the Jpanel/the text of the title? I have tampered with all the property settings and googled.

    Currently it is a light blue line and it's very hard to see. I don't even see anything in the initComponent() method that deals with the color of the line itself as if I could even edit it?


    Thanks in advance, this is getting annoying.
  2. #2
  3. <?PHP user_title("gimp"); ?>
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2005
    Location
    Internet
    Posts
    7,652
    Rep Power
    6084
    Try doing it by hand instead of with an IDE. Otherwise you'll keep ending up in this situation - you did stuff with an IDE and have no idea how to do it without one, so you have no idea how to change it.
    Chat Server Project & Tutorial | WiFi-remote-control sailboat (building) | Joke Thread
    Rational thinkers deplore the excesses of democracy; it abuses the individual and elevates the mob. The death of Socrates was its finest fruit.
    Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken. Use TODO to leave yourself reminders. Calling a program finished before all these points are checked off is lazy.
    -Partial Credit: Sun

    If I ask you to redescribe your problem, it's because when you describe issues in detail, you often get a *click* and you suddenly know the solutions.
    Ches Koblents
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2006
    Posts
    100
    Rep Power
    14
    Thanks for your reply.

    I only want the IDE for building the GUI, nothing else. I planned to code all the rest by hand.

  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2006
    Location
    True
    Posts
    873
    Rep Power
    106
    Originally Posted by theoryTim
    Thanks for your reply.

    I only want the IDE for building the GUI, nothing else. I planned to code all the rest by hand.

    I think thats what hes referring to you should use the IDE is there to make it easier on you so you don't have to go through the hassle of coding it all the time, but its there to make it easier for you after you actually know how to do it. Like a calculator, first you learn how to add, subtract, multiply and divide. When you get in higher maths, you can just use calculators to lessen the work.

    Comments on this post

    • Yawmark agrees
    • mrider agrees : !!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2006
    Posts
    100
    Rep Power
    14
    I apprecaite your guys advice but if you cannot help me, then why post?


    FYI - I've created alot of raw hand coded Java Applications as of now by hand and in TextPad. 3/4's of which all were GUI driven and I used many different layout managers. Not saying i'm a Java guru cause i'm very, and I mean VERY far from that.

    At monster.com and all the job sites I see that alot of the Java listings require familarity with Netbeans and/or Eclipse so therefore i'm trying to 'get familar' with these IDE environments.

    So if you can actually help me, i'm open ears.
  10. #6
  11. Feelin' Groovy
    Devshed Supreme Being (6500+ posts)

    Join Date
    Aug 2001
    Location
    WDSMIA
    Posts
    10,135
    Rep Power
    5054
    I apprecaite your guys advice but if you cannot help me, then why post?
    Because the primary purpose of this forum is to discuss Java platforms and APIs. Application support is great if someone knows the answer off the top of their head (if it's even an appropriate topic here at all), but if you're looking for how to make an application do something, it's probably a better idea to contact the application's support process. If you have a question as to how to write the appropriate Java code, that's another story, but that doesn't seem to be what you're asking.

    So if you can actually help me, i'm open ears.
    http://www.netbeans.org/community/index.html
    http://www.eclipse.org/community/

    ~

    Comments on this post

    • theoryTim agrees : Okay then I get the point
    Last edited by Yawmark; April 1st, 2007 at 10:05 PM.
    Yawmark
    class Sig{public static void main(String...args){\u0066or(int
    \u0020$:"v\"ʲ\"vΤ\"".to\u0043h\u0061rArray()
    )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
    +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}}
  12. #7
  13. Feelin' Groovy
    Devshed Supreme Being (6500+ posts)

    Join Date
    Aug 2001
    Location
    WDSMIA
    Posts
    10,135
    Rep Power
    5054
    Or if you're into Groovy...
    Java Code:
    import java.awt.*
    import javax.swing.*
     
    swing = new groovy.swing.SwingBuilder()
    gui = swing.frame(size:[200,200], defaultCloseOperation:JFrame.EXIT_ON_CLOSE) {
        panel(layout:new BorderLayout(),
            border:BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.RED), "foo"))
    }
    gui.visible = true

    Man, that's a slick little scripting language. Pure Java equivalent:
    Java Code:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
     
    import javax.swing.BorderFactory;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
     
    public class Foo {
    	public static void main(String[] args) {
    		JPanel panel = new JPanel();
    		panel.setLayout(new BorderLayout());
    		panel.setBorder(BorderFactory.createTitledBorder(
    				BorderFactory.createLineBorder(Color.RED), "foo"));
    		JFrame frame = new JFrame();
    		frame.add(panel, BorderLayout.CENTER);
    		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		frame.setSize(new Dimension(200, 200));
    		frame.setVisible(true);
    	}
    }


    ~
    Last edited by Yawmark; April 1st, 2007 at 10:22 PM.
    Yawmark
    class Sig{public static void main(String...args){\u0066or(int
    \u0020$:"v\"ʲ\"vΤ\"".to\u0043h\u0061rArray()
    )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
    +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}}
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2006
    Posts
    100
    Rep Power
    14
    Cool Yawmark.

    Unfortnately I don't have this problem when I created the GUI's by hand in Textpad and I've used the TitledBorder alot. I actually liked using the etched option along with it but thats okay.

    Like I said, i'm looking to get efficient in the Netbeans environment and every property i've looked at doesn't change the color of the bloody line.

    Thank you for taking the time to write out the code though. If I happen to find the answer/solution, i'll post it up for you people to know.

    (Finding help for Netbeans is impossible. Google returned 3 pages and 3/4's of the results didn't deal with anything related to the search.)

  16. #9
  17. Feelin' Groovy
    Devshed Supreme Being (6500+ posts)

    Join Date
    Aug 2001
    Location
    WDSMIA
    Posts
    10,135
    Rep Power
    5054
    Finding help for Netbeans is impossible.
    You may want to try your question on a NetBeans forum.

    ~
    Yawmark
    class Sig{public static void main(String...args){\u0066or(int
    \u0020$:"v\"ʲ\"vΤ\"".to\u0043h\u0061rArray()
    )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
    +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}}
  18. #10
  19. <?PHP user_title("gimp"); ?>
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2005
    Location
    Internet
    Posts
    7,652
    Rep Power
    6084
    Yawmark: I hate to be a bitch, but code 1, line 4, forgot a ;

    And I'm going to look into Groovy. Never seen it before. Thanks for pointing that out!
    Chat Server Project & Tutorial | WiFi-remote-control sailboat (building) | Joke Thread
    Rational thinkers deplore the excesses of democracy; it abuses the individual and elevates the mob. The death of Socrates was its finest fruit.
    Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken. Use TODO to leave yourself reminders. Calling a program finished before all these points are checked off is lazy.
    -Partial Credit: Sun

    If I ask you to redescribe your problem, it's because when you describe issues in detail, you often get a *click* and you suddenly know the solutions.
    Ches Koblents
  20. #11
  21. Feelin' Groovy
    Devshed Supreme Being (6500+ posts)

    Join Date
    Aug 2001
    Location
    WDSMIA
    Posts
    10,135
    Rep Power
    5054
    Originally Posted by gimp
    Yawmark: I hate to be a bitch, but code 1, line 4, forgot a ;
    What made you stop at line 4 (or miss lines 1 and 2)?

    Look into Groovy: no semicolons required. The script runs as-is*.


    * I test code before I post it, or announce otherwise.

    ~
    Last edited by Yawmark; April 2nd, 2007 at 03:29 PM.
    Yawmark
    class Sig{public static void main(String...args){\u0066or(int
    \u0020$:"v\"ʲ\"vΤ\"".to\u0043h\u0061rArray()
    )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
    +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}}
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2006
    Posts
    100
    Rep Power
    14
    For anyone who cares: the fix was so simple I am almost embarassed to post it up. In the border editor, once you click border another window comes up which you can choose from the original list of borders. LineBorder was what I was wanting.

    I didn't know you could apply the different borders to certain border layouts. Very sweet feature.

    I need to get a better grip on Java before I move to another programming language (Groovy is a cool name though. Be cool to say "Yeah I code in Groovy" lol.)

    Cheers for your peoples time though.
  24. #13
  25. Feelin' Groovy
    Devshed Supreme Being (6500+ posts)

    Join Date
    Aug 2001
    Location
    WDSMIA
    Posts
    10,135
    Rep Power
    5054
    I need to get a better grip on Java before I move to another programming language.
    At the bytecode level, they're the same language.

    I'm just kidding (not about them being the same language at the bytecode level -- that they are); I think sticking with Java until you have a good grip on it is "Good Thing".

    ~
    Yawmark
    class Sig{public static void main(String...args){\u0066or(int
    \u0020$:"v\"ʲ\"vΤ\"".to\u0043h\u0061rArray()
    )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
    +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}}
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2006
    Posts
    100
    Rep Power
    14
    I won't lie to you, the no usage/need for semi-colons would be great. So many compile errors where I simply just left one of those bad boys off the end there.

    Almost that feature alone would be worth switching languages , haha.
  28. #15
  29. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0
    Here you go. I signed up to post this. You can adapt this for color easily. I'm using it for changing border text.

    Code:
        public void setInformationScrollBorderText(String title) {
            TitledBorder info=(TitledBorder)this.informationScrollPanel.getBorder();
            info.setTitle(title);
            this.repaint();
        }

IMN logo majestic logo threadwatch logo seochat tools logo