Results 1 to 3 of 3
  1. #1
    pedymaster is offline Member
    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Default Use of canvas in NetBeans GUI

    Hi, I am doing a team project to school. It's program where I get some data, process them, enable simple editing and so on... we already have every functions and also have the GUI. The GUI has a lot of buttons, radioButtons and so on.... also it has two canvases. The problem now is that I just cannot figure out how to draw to them.

    So created that class JFrame so i have: public class MainGui extends javax.swing.JFrame { .....

    there is generated code from NetBeans IDE, listeners for buttons and some other things for the project... also there are those canvases :

    canvas1 = new java.awt.Canvas();

    canvas1.setBackground(new java.awt.Color(255, 255, 255));

    and

    canvas2 = new java.awt.Canvas();

    canvas2.setBackground(new java.awt.Color(255, 255, 255));


    Now, can anyone tell me please how to draw to them? Just an example with a single line, but such that I can paste it to code or something like that.... I've been trying and searching for hours... few days you can say...

    Thanks a lot for help.

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

    Default Re: Use of canvas in NetBeans GUI

    1. Don't mix AWT and Swing components in the same GUI.
    2. Learn what you need from this Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    there is generated code from NetBeans IDE
    From the Visual designer, not the IDE. That designer isn't a beginners' tool. Dump it and learn to code your GUI yourself.

    Just an example with a single line, but such that I can paste it to code
    This is a forum, not a code mill. Also, there's no one line solution.

    I've been trying and searching for hours... few days you can say...
    Really?

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

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

    Default Re: Use of canvas in NetBeans GUI

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

Similar Threads

  1. Replies: 0
    Last Post: 07-05-2009, 12:31 PM
  2. Help with canvas
    By tankhardrive in forum New To Java
    Replies: 13
    Last Post: 10-29-2008, 08:08 PM
  3. Replies: 0
    Last Post: 10-28-2008, 09:28 PM
  4. Using SWT Canvas
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-08-2008, 09:06 AM

Posting Permissions

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