Results 1 to 5 of 5
  1. #1
    MW130 is offline Senior Member
    Join Date
    Jan 2013
    Posts
    317
    Rep Power
    2

    Default Going beyond Swing?

    So, I was reading a very old post about Swing being dead, and a guy on it said it's not. He said that if you need something that Swing can't provide, like a bar graph, you build it. Now, being used to just writing a method that will open up a JFrame, I have no idea how you would actually build graphics on your own. How in the world would that work? How would one write their own methods to make a window or to build a graph? Seems extremely crazy and difficult.
    Thanks guys

  2. #2
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Re: Going beyond Swing?

    Quote Originally Posted by MW130 View Post
    So, I was reading a very old post about Swing being dead, and a guy on it said it's not. He said that if you need something that Swing can't provide, like a bar graph, you build it. Now, being used to just writing a method that will open up a JFrame, I have no idea how you would actually build graphics on your own. How in the world would that work? How would one write their own methods to make a window or to build a graph? Seems extremely crazy and difficult.
    Thanks guys
    Not at all, actually very simple. You would need a class that extends JPanel and overrides the paintComponent(Graphics g) method. In there you could make a simplistic set of rectangles based off of input values to make your bar graph. Read up on Java 2D Graphics.

  3. #3
    superhaNds is offline Senior Member
    Join Date
    Apr 2013
    Location
    Sweden
    Posts
    264
    Rep Power
    2

    Default Re: Going beyond Swing?

    There are multiple external libraries for graphs. You will not needlessly reinvent the wheel unless you want to do something very specific.

    JFreeChart is one I have used and I also know Google has one.

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Going beyond Swing?

    Re. Swing being dead: there's a newer GUI toolkit called JavaFX2 that was positioned as a replacement for Swing. The problem is that Swing is very well established as "the" Java GUI toolkit. Whatever theoretical superiority JavaFX2 has over Swing, the marginal utility is not enough for developers who already know Swing to learn something else. And new developers are inevitably going to encounter Swing code, so they still need to learn Swing. JavaFX2 is too little, too late.
    Get in the habit of using standard Java naming conventions!

  5. #5
    pj6444 is offline Senior Member
    Join Date
    Jan 2013
    Posts
    164
    Rep Power
    2

    Default Re: Going beyond Swing?

    You can always make your own graphs with the paintComponent(Graphics g) class. If you want to update what you have in that method you can just call the repaint() method. Here is a link to teach about the graphics class. Graphics (Java Platform SE 7 )

Similar Threads

  1. Need Help in Swing
    By Hrithik516 in forum AWT / Swing
    Replies: 2
    Last Post: 09-16-2012, 04:41 AM
  2. need some help in Swing
    By skuskusas in forum AWT / Swing
    Replies: 4
    Last Post: 08-29-2012, 06:46 PM
  3. swing.jar
    By krrishnak in forum AWT / Swing
    Replies: 2
    Last Post: 04-05-2009, 05:29 AM
  4. Swing Ide?
    By makpandian in forum AWT / Swing
    Replies: 2
    Last Post: 12-28-2008, 05:07 PM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 07:02 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
  •