Results 1 to 10 of 10
Like Tree2Likes
  • 1 Post By DarrylBurke
  • 1 Post By DarrylBurke

Thread: How to run/test a Jframe

  1. #1
    moisesbr is offline Member
    Join Date
    Aug 2013
    Posts
    5
    Rep Power
    0

    Default How to run/test a Jframe

    I am new to Java and trying Netbeans.

    I created a jframe and inserted some components in it.

    How to execute (run) the jframe ?

    I mean, how to test it without leaving the desing mode to see what happens with buttons, textboxes, etc ?

    Moises

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: How to run/test a Jframe

    The NetBeans visual designer is categorically NOT a beginners' tool. I recommend you learn the fundamentals of Java and go on to Swing and/or JavaFX GUIs, starting here: The Java™ Tutorials

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

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to run/test a Jframe

    Quote Originally Posted by DarrylBurke View Post
    The NetBeans visual designer is categorically NOT a beginners' tool. I recommend you learn the fundamentals of Java and go on to Swing and/or JavaFX GUIs, starting here: The Java™ Tutorials

    db
    Hey, the tool itself is easy to use though. Drag, drop, adjust, hammer and sponge. Even a beginner can do that. Its what it produces (the code) that is categorically not for beginners.

    In any case if you want that kind of "hot swap" of changes, you need the Netbeans platform. This series of videos not only explains how to do it, but should also give an idea of how complex this material really is and hopefully discourage to go further down this road right now and go back to the basics, as suggested by Darryl.

    https://platform.netbeans.org/tutori...-top-apis.html
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    moisesbr is offline Member
    Join Date
    Aug 2013
    Posts
    5
    Rep Power
    0

    Default Re: How to run/test a Jframe

    Yes, although I am a beginner I suppose there must be is simple a way to run a Jframe.

    e.g, in Visual Fox Pro we have a "do form" command and then we can see the form running.

    I tried "execute" command at top menu of Netbeans, but it does not seem to run the jframe.

    Moises

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to run/test a Jframe

    Well then you're doing something wrong. The trouble is: you don't know anything about Swing (and probably Java) so you can't explain why. And that's why the designer tool is not for beginners, you don't know how to deal with problems yet. You must first learn how to program this stuff by hand, without any click & play tool.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    moisesbr is offline Member
    Join Date
    Aug 2013
    Posts
    5
    Rep Power
    0

    Default Re: How to run/test a Jframe

    Quote Originally Posted by gimbal2 View Post
    Well then you're doing something wrong. The trouble is: you don't know anything about Swing (and probably Java) so you can't explain why. And that's why the designer tool is not for beginners, you don't know how to deal with problems yet. You must first learn how to program this stuff by hand, without any click & play tool.
    ok, Gimbal2. So you mean jframe is not a final form to be executed and displayed in my windows desktop ? I agree with that I must learn how to code, but I found Netbeans very useful at fist sight, because I was able to connect to mysql automatically and saw my tables on Netbeans left panel. I managed to import data to a table on jframe, but got stuck on trying to display data. But I imagine there could be way to show some data on jframe without some code, isn't ?

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to run/test a Jframe

    Nope, there isn't. That designer tool you're using is also generating code. Code for which you don't know what it does.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: How to run/test a Jframe

    @moisesbr: I also worked in VFP (and FoxPro before that, and FoxBase before that, and dBase before that ...) and when I got my free NetBeans 5.5 CD about 6 years ago I created a 'form' minutes after installing and launching NB. Like you, I didn't know what to do to 'run' the 'form'.

    A few days later, I started learning Java. I've never gone back to the visual designer since, except occasionally to answer a designer-specific question, and then only when I can perceive that the poster does understand Java coding, has the experience to be tackling an advanced tool, but can't quite find his/her way around the labyrinth of menus and settings.

    Believe me, it's actually easier to hand-code a Java GUI. The visual designer has a steep learning curve; it's only worthwhile if you're planning to go into full time Swing GUI development. Which would anyhow not be advisable as Swing is now in maintenance mode, and JavaFX is the new kid on the block.

    @gimbal2: The VFP form editor also generates code, but you normally get away with only looking at the segments you write yourself.

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

  9. #9
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,036
    Rep Power
    6

    Default Re: How to run/test a Jframe

    Actually, I tried to use it once, many years ago when learning Java and was totally confused. So now I rely on just using Layout managers. But I can think of a use for these by even a beginner. Use it to simply design your GUI in terms of field and panel placements, moving them around until you like the way it looks. Then print out the image of the GUI and code it by hand. Of course, there are probably tools to do this (not PowerPoint and its ilk) but I don't know of any and haven't looked into it.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to run/test a Jframe

    Quote Originally Posted by DarrylBurke View Post
    @gimbal2: The VFP form editor also generates code, but you normally get away with only looking at the segments you write yourself.
    Indeed, until something doesn't work ;) And then you're about as stuck as you can possibly get. Randomly clicking around or starting over from scratch will be the only way out.

    Agreed that coding it by hand is actually easier. It does take a bit of practice because you have to "see the matrix" through the code, but when I was doing lots of Swing programming I tended to have basic patterns that I kept repeating; combinations of layout managers and nested containers to repeatedly solve the same basic layout problems. You recognize the pattern and then can instantly know what that looks like on screen; once you get to that point, you basically program together a (working) GUI in no time at all. I wouldn't ever dream of using a drawing tool, so slow and cumbersome and worst of all - you don't learn anything from it.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Click in JFrame Titlebar sets the JFrame Opaque
    By tim8w in forum AWT / Swing
    Replies: 1
    Last Post: 02-02-2013, 08:29 AM
  2. Pls help me, I can't test my JFrame
    By RichersooN in forum New To Java
    Replies: 2
    Last Post: 08-23-2012, 12:52 PM
  3. Replies: 3
    Last Post: 11-27-2011, 06:18 AM
  4. Replies: 5
    Last Post: 06-14-2010, 07:10 PM
  5. Replies: 0
    Last Post: 04-05-2008, 01:38 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
  •