Results 1 to 10 of 10
  1. #1
    Hellops is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default Component/Widget creation

    Hi I'm new to Java and a little confused.

    I cannot tell for sure the difference between component and widgets and how to create my own.

    For example in QT/KDE controls that in java are called "components" are called "widgets".

    Any way to give an example I want to create a database browser that will contain a few labels and buttons, and integrate it on a project. Or even with composition create a text field that will have extra input control/restriction that will suit my needs.

    How do I do this? All tutorials I found on google are not very enlightening..

    Is it possible to make it visible on the netbeans pallete, after i create it?

    Thanks.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    You don't need that. Swing has all you need. Restricting input can be done with JFormattedTextFlieds or using a DocumentFilter.
    Tutorials:
    Trail: Graphical User Interfaces (The Java™ Tutorials)
    http://www.java-forums.org/java-tuto...-tutorial.html
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Hellops is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by PhHein View Post
    You don't need that. Swing has all you need. Restricting input can be done with JFormattedTextFlieds or using a DocumentFilter.
    Tutorials:
    ]
    Ok thanks for the tutorials but this was an example..

    I still need to create reusable gui components. The databrower is one I need like hell rifht now. So if there is a specific tutorial or outline instructions on how I can create my own component/widget or whatever's called in Java will be GREAT help.

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    I still don't see why you need your own component. You need a panel with some components on it. The tutuorials tell you how to do that.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  5. #5
    Hellops is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by PhHein View Post
    I still don't see why you need your own component. You need a panel with some components on it. The tutuorials tell you how to do that.
    Can I use this panel in 10 diferrent windows and 3 different apps without copy paste it around/renaming fields/messing code?

    If yes ok. If no, eh code reusability has a point.

  6. #6
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Yes, you can use that where you like.

    Maybe you should also have a look for an OO tutorial.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  7. #7
    Hellops is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by PhHein View Post
    Yes, you can use that where you like.

    Maybe you should also have a look for an OO tutorial.
    Dont get u... I programm in C++ for over 10 years and have a collection of specific components I use around apps.

    i'm new in java, but I cannot really understan if your newer than me. My question was clear.

  8. #8
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Hellops View Post
    Can I use this panel in 10 diferrent windows and 3 different apps without copy paste it around/renaming fields/messing code?
    If yes ok. If no, eh code reusability has a point.
    Your question is quite clear and the answer has been given clearly above: "yes". You can create a JPanel that holds whatever components you like, put it in a class, and then use this class in innumerable projects. It's what OOPs is all about.

  9. #9
    Hellops is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    Your question is quite clear and the answer has been given clearly above: "yes". You can create a JPanel that holds whatever components you like, put it in a class, and then use this class in innumerable projects. It's what OOPs is all about.
    OK. If you read what I asked you'll see that is not exaclty the subject.
    I was just wondering if there is a GUI tool to do this, like the tool for creating control libraries in VS etc(automation in general), and if it possible to integrate it to the netbeans pallete so I can visually manage it on applications. I'm reading a lot about widgets and components, javabeans etc but not enough examples are on...

    Ofcourse its a matter of OOP:
    I can design a panel with what I need on, set layouts, splitters blahblah and copy the generated code(so I dont sweat a lot) in a class that extends jpanel where I give the rest functioality and override the methods of the rest components on, etc

    What Ive just said could have been an answer to my question in the first place as it is concerns the metodology, but not really tells me about the rest. As Ive already told Im NEW to java (not OO)

    Anyway, thanks
    Last edited by Hellops; 10-16-2009 at 04:30 PM.

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Ah, then you're not asking a Java question per se, but rather a NetBeans question (how to place a widget on the NetBeans palate). Then if you don't get an answer here, you may need to ask this in a NetBeans forum. If you do ask this elsewhere, we ask you to post a link. Much luck.

Similar Threads

  1. Simple widget advice...
    By billy341 in forum SWT / JFace
    Replies: 0
    Last Post: 04-04-2009, 08:58 PM
  2. Creating a link widget
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-25-2008, 02:25 PM
  3. Creating and initializing a SWT spinner widget
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 04:50 PM
  4. How to capture a widget image with a GC
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:00 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
  •