class « GUI « Java Swing Q&A





1. How to extend IconNodeWidget class in java?    stackoverflow.com

I should make a GUI that uses Visual Library. I have a scene where users can put nodes and edit some propierties. Then I want to save each node propierties. For ...

2. Java Swing: what class can be used to implement this?    stackoverflow.com

What Swing class can I use to implement something like this? Add To List EDIT: Hmm..for some reason I cannot add the image here. Well, here's the link: Basically, ...

3. How to use a linkedList and multiple classes with my Java GUI    stackoverflow.com

How should I use a linked list with my GUI program? The program is supposed to have blocks (a block being a JPanel) with textareas and dropdown menus. The number of ...

4. GUI from class definition    stackoverflow.com

Is there a lib that can build a simple GUI by looking at a class or method signature? For Example:

class MyMath{
    public static double sqrt(double d){
    ...

5. Cannot refer to a non-final variable    stackoverflow.com

I'm trying to create simple GUI program in Java and I couldn't find a proper solution to error cannot refer to a non-final variable inside an inner class defined in a ...

6. Get return value from new class with gui    stackoverflow.com

I have a class that extends JFrame to make orders. in the middle I have a button that opens a new window that is used to find an article. What I need ...

7. Add GUI functionality to a Java class    stackoverflow.com

i have a java class that i want to add some gui functionality to so that i can for instance return book titles or cost, i know i need to implement ...

8. 2 different GUI in 1 class in Java    stackoverflow.com

I have 2 different types of input. I prompt an alert window for users to select which type of input they want my system to process. Let's say 1st type of ...

9. Java: How can I load an external class into a gui    stackoverflow.com

I'm looking for a specific functionality. I want to load a class that extends JPanel for instance and show that JPanel on a separate GUI class. I'm looking for the ability to ...





10. splitting up a GUI into different classes    stackoverflow.com

i have done a GUi which contains everything in one class but i would like to split it up into different classes, for example one with the main, initializing the frame, ...

11. Calling main method of another class GUI    forums.netbeans.org

Hi I'm very new to building GUIs in Java, I wonder if someone can help me with this probably very basic question. I have a frame with a few jbuttons. I ...

12. Calling main method of another class (GUI)    forums.netbeans.org

raharley Joined: 26 Feb 2010 Posts: 2 Posted: Fri Feb 26, 2010 12:47 pm Post subject: Calling main method of another class (GUI) Hi I'm very new to ...

13. awt classes    coderanch.com

14. how to instantiate a class    coderanch.com

class DynamicClassLoading { public static void main(String s[]) { String className = "java.awt.Frame"; Class cls = null; Object object = null; try { cls = Class.forName(className); System.out.println("Class loaded....."); } catch(ClassNotFoundException ce) { ce.printStackTrace(); } try { object = cls.newInstance(); System.out.println("Class Instantiated....."); } catch(InstantiationException ie) { ie.printStackTrace(); } catch(IllegalAccessException e) { e.printStackTrace(); } System.out.println("I'm object of class : "+object.getClass().getName()); } }

16. Convert .class to .exe    coderanch.com

Hello! I need to convert an application(.class) into an executable file(.exe). My main problem is that the application uses Swing components, and it has to be able to run on Win 98 and upwards. So my question is how I can make sure that the application will be executable on these platforms even though it uses Swing? Will there be any ...





18. What are the benefits to using the SWING class?    coderanch.com

The main problem with AWT was that the component look and feel and behavior was dependent on the OS platform where the VM executed. Thus, this is a violation of the platform neutrality that Java promises. Swing is a set of "lightweight" components. I.e. there is lesser dependency on the native platform windowing toolkit. Also, Swing allows you to do things ...

19. hide the classes    coderanch.com

20. Can't find swing classes    coderanch.com

21. Pre Loaded Class with static values needed    coderanch.com

Hi, I'm working on a Swing application , where I would prepare some lookup data (getting data from Data base) and store in some strings , when the application starts for the first time. I would like to access these strings from anywhere in the application i.e should be accessible from multiple classes . This is required to reduce the overhead ...

24. About multiple extending classes    coderanch.com

Hi I have a Swing interface that I divided into separate classes (20 classes). Each class (that extends Jpanel) of them contains part of the GUI , to collect them i use a main class that instantiate each one of the classes and by running the main class I see all the GUI. whenever i want one class to effect instance ...

25. How to make an instance of a class?    coderanch.com

Hello, Ok you must be wondering if am crazy cause am asking how to make an istance of a class. Ok let me first point out I know how to make an instance of a class . However I have an unsual situation. Consider the short code below import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; class Test { ...

26. Swing classes not recognized    coderanch.com

Hi folks, I 'm stuck with a problem I've never seen before and was hoping you could help. Out of all 72 of my students, there is one chap whose Java Virtual Machine doesn't seem to recognize any of the Swing class libraries. I've reinstalled different JDK binary sources, different versions (1.3 and 1.4) and even tried installing the JDK on ...

28. No groupbox class?    coderanch.com

import javax.swing.*; import java.awt.event.*; import java.awt.*; public class GroupBoxTest extends JFrame { public GroupBoxTest() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent w) { System.exit(0); } }); this.getContentPane().setLayout(null); JPanel groupBoxPanel = new JPanel(); groupBoxPanel.setLayout(null); groupBoxPanel.setBorder(BorderFactory.createTitledBorder("Group Box 2")); JButton b = new JButton("Push Me"); b.setBounds(10, 20, 100, 20); groupBoxPanel.add(b); groupBoxPanel.setBounds(5, 5, 300, 300); this.getContentPane().add(groupBoxPanel); this.setBounds(100, 100, 500, 500); } public static void main(String[] ...

29. problem with MyClass.class.getResource()    coderanch.com

public class JTEdi { public static void main(String[] args) { JTEdi.createImageIcon("images/new.gif"); java.io.File file = new java.io.File("images/new.gif"); if (file.exists()) { System.out.println("yessss"); } } private static ImageIcon createImageIcon(String path) { URL imgURL = JTEdi.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL); } else { System.err.println("Couldn't find file: " + path); return null; } } }

30. GUI class is getting big...    coderanch.com

Hi, My user interface is composed of a series of related panels grouped on one frame. My panels are all in the same class, and that class is getting pretty big. I would like to create classes out of a few panels to separate the code. Is this a good idea? Thanks, Marie

31. RescaleOp Class    coderanch.com

the constructor of RescaleOp is: RescaleOp(float scaleFactor float offset, null) It performs function, pixel = pixel * scaleFactor + offset, for every pixel of a image. I have two sliders to change the values of scaleFactor and offset on the GUI and the program does change the effects of the image. But I cannot change the image back to the original ...

33. about the read() in the FileReader class...    coderanch.com

There isn't a font in the character array to be changed. A font to be used can be specified when text is displayed on certain components. I'm moving this to the Swing / JFC / AWT forum where they like to talk about this fancy display stuff. Also, floatingkent is not an improvement over your original display name. Again, please change ...

34. Repeat class method call 'new obj' question    coderanch.com

Thank you for the info about the validate()! But part of my question still remains. Concerning the way the methods are called and the "new obj" in each call. This adds a new instance of the component to the getContentPane().getComponentCount() of the JFrame. So inevitably this will become a memory hog. If you could reread my original question, forget about the ...

35. load a class    coderanch.com

you must have main class for control UI and UI module class is base class for create UI in each panel package com.account.ui; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.lang.reflect.Constructor; import java.util.Vector; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ButtonGroup; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; ...

36. what is "myclass$1.class"?    coderanch.com

Hi Glen, These are anonymous classes. You see, every compiled class must have a bytecode file, right? Well, anonymous classes are named as $.class. Just so you identify the anonymous classes in your code, they shall look like this: public class ParentClass { private interface MyInterface { void myMethod(); } public static void main(String[] args) { /* Here is the anonymous ...

37. Class inheritence and GUI question    coderanch.com

Hi all. I am working on a server program that has a GUI. I created the server code in a separate class that is in herited by a thread initiated by a button in the GUI. I would like to bounce text messages back from the server class to the GUI (and display them in a JText control)- is this possible? ...

38. ButtonHandler outside of class    coderanch.com

There's no standard Java API class named "ButtonHandler"; perhaps it's part of some specialized API, or perhaps this is a non-Java thing you're talking about? In any case, if you can refine your question a bit -- tell us what you need to do, exactly -- I'm sure somebody can help you.

39. Use of RandomAccessFile class under Swing    coderanch.com

By "put codes" I hope you don't mean you want someone to do all your work for you. As to the rest of your post, I really am not clear on what you are wanting. Probably, as this forum is home to thousands of people from all over the world, we have a bit of a language barriar. If at all ...

40. GLCanvas class    coderanch.com

41. One class calling another class incharge of GUI    coderanch.com

If your addListeners() method is in the ManagerGUI class, then you already have the values in the ManagerGUI class; as soon as you click those buttons, the ActionListeners put the values into your name String (etc). So your first problem is sorted out already. You don't say what processing you are doing, so I shall presume you already know how to ...

42. Class & GUI    coderanch.com

43. ByteLookUpTable class help.....    coderanch.com

44. Anonymous Classes question    coderanch.com

I'm taking an Intro to Software Engineering class using Java and we just covered GUI's. This is the first I had heard of Anonymous Classes so I thought I'd post my question here. Anyway, the text mentions Anonymous Classes should only be used if the event handling code is only very small such as one line. Is this a hard and ...

45. doubt reg eventlisteners in awt classes?    coderanch.com

hai, While programming in awt why we should give (this) as parameter instead of giving the classname itself as parameter! for example! public class Sampleframe extends Frame { ... ... addactionListener(this); ... ... .... } Here i could have given addactionListener(Sampleframe) why i should use this even if i hadnot created an object! cheers, Bye!

46. When to use anonymous class    coderanch.com

Performance: don't know. If you search these fora, you will find differing opinions, some people favouring anonymous classes, others disliking them. Fortunately there are few people who recommend "addActionListener(this);" I am one of those hwo like anonymous inner classes, but have a little rule of thumb:- If your Listener does something completely different from all the other Listeners, then anonymous is ...

47. Output from a class shown in GUI?    coderanch.com

Hi there I was wondering if any kind soul could help me out, I have a class which when run outputs a lot of output strings etc. I have a second class which runs a simple GUI with a JButton to open another GUI, in that new GUI I am trying to get the output from my class file to appear ...

48. calling another GUI class    coderanch.com

import java.awt.event.*; import javax.swing.*; public class NewClass implements ActionListener { public void actionPerformed(ActionEvent e) { // Use the new operator to create an instance of the class // you want to instantiate. Save a reference to it and use // this reference to call methods in the class. AnotherClass anotherClass = new AnotherClass(); String s = anotherClass.sayHi(); System.out.println(s); } private JPanel ...

49. running a class a particular number of times    coderanch.com

hey can some please tell me how to run this class a specific number of times. maybe by using a for loop?. i am making a game called memory game where you match the cards which are the same. i want to make this a multiplayer game rather than a single player game. Thus in order to do this i need ...

50. Class reference    coderanch.com

51. Getting outer class reference    coderanch.com

Daesung, Brian thanks for the replies. The e.getSource was staring at me in my face, and I was looking in a different direction! How silly can I get! Yes. I was not aware of the Qualified.this Thanks for the new information. Once again thanks to both of you for taking time to point me in the right direction.

52. Class Communications    coderanch.com

Please use code tags (beneath the message window; it makes code much easier to read. Get rid of the "implements ActionListener" and the actionPerformed() method. Put the actions where they belong, on the MenuItems. Add this sort of code to your constructor.. . . quitItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { System.exit(0); }//end actionperformed }//end anonymous inner class ); ...

53. Accessing Class    coderanch.com

Hi, i have written the GUI code in a class. And in another class i have written the code for displaying the database table. Both the classes give the output correctly. But what i wand is to display that table in the GUI which consists of an empty panel. Can any body give me some ideas to how to combine this ...

54. failed to load Main-Class manifest attribute??    coderanch.com

Hi, I have a swing application. When I run the app from IDE (Netbeans 6.0) it runs fine. If I try to run by clicking .JAR file, it will show "failed to load Main-Class manifest attribute from file.JAR". I extracted the .JAR file and I found MANIFEST.MF didn't had Main-Class field. Even i added that field and zipped it and renamed ...

55. Class & GUI    coderanch.com

56. Interaction between GUI class and "main" class    coderanch.com

Hello. I guess this is a very basic question. But, that's why I'm posting it in the beginners section... I have written a simple game that asks questions to which the user answers by pressing buttons. I have put all the GUI stuff in a separate class and everything else in another class (let's call it the "main class"). The main ...

57. multi class gui    coderanch.com

Hello to all. New to Java here. What I have here is a simple text editor with a menu bar containing as follows: File Edit Tools Help. ScratchPad is the name of my text editor class. Everything is working to my liking thus far. I have created a class called Help containing another form that will allow the user to navigate ...

58. How to return value from child gui to parent class    coderanch.com

Hi friends, I am developing an application in swing. In this i have a main class from which i am creating a login view. Authentication is done by login view and if it is success it will rturn boolean true and then the main class will load another frame after closing login view. But i am confused how to return value ...

59. How to navigate between multiple GUI classes    coderanch.com

Hello all Ive got to replicate a sat nav system for my dissertation, and ive got numerous screens, but i would like assistance on how to move between the screens. I need the system to close the current screen and open the next screen and move in between etc, but i dont know how to do that Can anyone help??? Harv ...

60. How to add a gui from different class    coderanch.com

Hi guyz. You may understand what i need if you look at the code below import javax.swing.*; import java.awt.*; public class exp { JFrame frame; public exp() { frame = new JFrame("Test"); JPanel panel = new JPanel(); JLabel l1 = new JLabel("Hello Java Swing"); panel.add(l1); frame.getContentPane().add(panel); frame.setSize(200,200); frame.setVisible(true); } public static void main(String args[]) { new exp(); } } This is ...

61. Returning a value from anonymous classes.    coderanch.com

So, I want to create a dialog that does more the just the general JOptionPane does. Essentially, they type in a Unicode value, and it displays on the JLabel to the left. I want the method to return the char value when the user click the accept JButton. How would I do this? public static void importCharacterSpriteDialog() { final JDialog diag ...

62. Making two classes work together (newbeginner)    coderanch.com

Hi, I trying to use jmenuitem to call other class. When you click the jmenuitem you get the other class gui. But mine actionlistener part working. It removes all but doesnt fill/get the from other class. Here is the codes. First one is the main: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Mainclass extends JFrame { private static final long ...

63. Am i making use of classes in the right way?    coderanch.com

package ruby; import javax.swing.*; public class Rubyframe { public void myframe() { JFrame frame = new JFrame("Ruby 0.1");; JPanel panel = new JPanel(); JLabel label = new JLabel("Welcome to Ruby 0.1"); JButton buttonA = new JButton("Quit"); JButton buttonB = new JButton("Click Me"); frame.add(panel); panel.add(label); panel.add(buttonA); panel .add(buttonB); frame.setSize(200,250); frame.setVisible(true); buttonA.addActionListener(new Leave()); buttonB.addActionListener(new Message()); } }

64. Reference to the outer class    coderanch.com

66. accessing items in other classes    coderanch.com

public class MainView extends javax.swing.JFrame { private javax.swing.JDesktopPane jDesktopPane1 = new javax.swing.JDesktopPane(); private void OpenTicket(String TicID, String LName, String FName, String SysID) { //all sorts of stuff figuring out if a window can be opened and finally opens the window } private void InfoButtActionPerformed(java.awt.event.ActionEvent evt) { Info infopage = new Info(conn, User); jDesktopPane1.add(infopage, javax.swing.JLayeredPane.DEFAULT_LAYER); infopage.setVisible(true); } }

67. OOP Modeling - Separate GUI from implementaion-How to refer to class where have more than one method    coderanch.com

I have class with GUI implemented and there I have a 3 text area (for plainText, for keyword and for cipherText)encryption button. I would like to implement Playfair and Vigenere cipher on on click event. But Playfair and Vigenere are separated classes, with a few methods. How do I do that connection between them ? Classes follows: public class CipherTextGeneratorView extends ...

68. How do I make a subclass known at the top level class?    coderanch.com

I don't want to change my code because I'm in a tight deadline. I defined a subclass within another class but then I found out that I really need the subclass to be known at the top level because I need to control it's MouseListeners at the top level. How to I return a CardLabel() class that is defined within HandPanel() ...

69. How to deal with the GraphicsEnvironment abstract class ?    coderanch.com

I tried the following code and get the error message shown in the comment. I do not understand what the following explanation/hint means : "Instances must be obtained from a suitable factory or query method." What is a factory or query method ? /* GraphicsEnvironment protected GraphicsEnvironment() This is an abstract class and cannot be instantiated directly. Instances must be obtained ...

70. Meaning of ClassName.this    coderanch.com

71. communication between classes    coderanch.com

Hi guys, I've got a bit of a noob problem here: Background story: the code for my checklist application is getting to big, so i'm trying to cut it up into smaller pieces. With each checklist in a different class and the GUI with all the save and load buttons in the main class. So at the moment I'm working on ...

72. Connections between classes    coderanch.com

73. Communication between GUI classes    coderanch.com

I am struggling with GUI design regarding the best way to encapsulate and enable communication between a customJFrame, customContentPane, customJMenu, mouseHandler, and graphicsData. My customJFrame instantiates customContentPane, customJMenu, and mouseHandler. My customJMenu.actionPerformed() instantiates graphicsData and reads the file into graphicsData when a user opens a file from customJMenu. Questions: 1. How can customJMenu get customContentPane to paint graphicsData when customJMenu does ...

74. communicating/affecting another class    coderanch.com

I am trying to develop a sudoku solver and have developed the GUI class and i want a seperate Button class which affects the 9x9 grid in the GUI class. How does the communication take place is it through passing arguements via methods or some other way? Any help would be gratefully appreciated. GUI CLASS import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; ...

75. Why so many classes?    coderanch.com

import javax.swing.*; /** * @version 1.32 2007-06-12 5. * @author Cay Horstmann 6. */ public class FrameTest { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } class SimpleFrame extends JFrame { public SimpleFrame() { setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); } public static final int DEFAULT_WIDTH = 300; public static final int DEFAULT_HEIGHT = 200; }

76. last week of class last assignment. Any help is appreciated.    coderanch.com

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package wk5calcjp2; // Import packages that are used within the program import javax.swing.*; import java.awt.event.*; import java.lang.Math.*; import java.text.NumberFormat; import javax.swing.ButtonGroup; import java.awt.Graphics; import java.text.DecimalFormat; /** * * @author LeeAnne Murphy * Java Programming 2 / PRG 421 * Due September 5, ...

78. gui classes    java-forums.org

hey i need help urgently. i've been looking for solution for this for a week nw and i need to hand this in by thurs... :( i got the basic look of the application. when i open bmi, it does open a new frame. but when i put values to be calculated. it doesn't show up in the resultfield. ps: the ...

79. GUI problem when call another class    java-forums.org

80. Basic GUI question (showing info from another class)    java-forums.org

public static void main (String[] args) { person john = new person(); //created a new object called person john.setHeight(175); CustomFrame frame = new CustomFrame(); //Your JFrame class is called //CustomFrame frame.setHeight(john.getHeight()); //Assuming your frame class has this method frame.display(); //This method probably makes the frame visible, display it in the //center, etc.

81. Using Scanner class in GUI    java-forums.org

Is there a way to implement the Scanner class into a GUI class? Or if not is there a GUI equivalent? I am trying to use a scanner class in combination with a file reader to read in a file to an array but it's just not working. everything except for the scanner declarations work fine. but the scanners throw a ...

82. Basic gui - just need to know what classes i must have    java-forums.org

Hi everyone, I am trying to do my assignment. It requires me to write a program for a warehouse. Below are the details The program is to be menu based and is to allow options for adding, viewing and finding customer, product and order information, and creating reports. Customer details, product details and order details are to be stored permanently in ...

84. Split GUI to more classes?    forums.oracle.com

I like to keep my classes small and focus on one thing. So to not make my GUI code messy I have split it in 2 parts. One with the frame(GUIFrame) initiates the other(WestPanel), which controls all my JButtons, JCheckBox etc. But when I wanna put my buttons to use by implementing ActionListeners(Created as inner classes in WestPanel) thats when I ...

85. java GUI classes    forums.oracle.com

Hi, I created a simple aplication to store student data in a database.Got a set of classes like student.java subject.java teacher.java ,and another set of clases that produce the GUI screen. My question is,are the classes created for the GUI screen,included in the CLASS DIAGRAM? Would be good if some-one helps on this. Rahul

86. java GUI class included in class diagram?    forums.oracle.com

88. Appending to a GUI from a seperate class...    forums.oracle.com

FileSearcher should have a reference to an interface which RunFileSearcher implements. The interface should have a method named something like addLogRecord(String) You do also have an error FileSearcher. You should use sleep instead of wait, and the argument is milliseconds and not seconds. It's also pretty pointless to recreate the File object in the loop. Kaj

89. Help: class comunication with GUI code    forums.oracle.com

Hello again! i just whanted to say thank you to both of you that answered, specially to the first responder that guided me towards MVC in he first place. Both your reference helped me to search in the right area and I now understand the basic with MVC code structure. I manage to make the program i set out to, and ...

90. Good practice on passing GUI information to classes?    forums.oracle.com

I'm totally new to GUI programming suing java and swing components. So far I have onlu done GUI programming with old fashoned C-style approach. Anyway, I have a GUI built upon a tabbed pane, which holds alot of information. Every pane has components in it describing some characteritics that the user can modify. For ever pane I have also created a ...

91. Nested classes and GUI integration    forums.oracle.com

92. Question regarding separate GUI and Engine Class    forums.oracle.com

Hi, I was given a task of implementing a java Watch, and i'm suppose to design a Watch GUI and the Watch engine in 2 different classes (WatchGUI and Watch Class). The specs insist that the watch engine class is suppose to work with other Watch GUI if design by another person. My question is if I have a button in ...

93. possible to create GUI class but not show it?    forums.oracle.com

94. GUI class question    forums.oracle.com

Hi guys I use the NetBeans 6.0 and i build a project which has 2 Source packages on is my number game and the other I called GUI. In the GUI source package I drew a diagram which I want to use as my GUI to my number game but I don't know how to connect them. Now my question is ...

95. help with GUI (calling one class from other class)    forums.oracle.com

Hi everybody, I am new at GUI and I need your help.. I have a JPanel, named "holdAll", layout of which is set to BorderLayout. I have implemented all other JPanels in different class files. For example, I have TopPanel, LeftPanel, etc. as shown below LeftPanel myLeft = new LeftPanel(); holdAll.add(myLeft, BorderLayout.WEST); RightPanel myRight = new RightPanel(); holdAll.add(myRight, BorderLayout.EAST); TopPanel myTop ...

96. help needed with swing class - GUI    forums.oracle.com

Hello I need to create a GUI to show battery levels. (battery level implemented and works fine in terminal). this is the output from the terminal: ACLineStatus: Offline Battery Flag: Lowthe battery capacity is at less than 33 percent Battery Life: 3265sec Battery Left: 32% Therefore i need 2 show the above in GUI with a kind of bar (like in ...

97. import a gui into a normal class    forums.oracle.com

ok well i am working on a project and for purposes of structured programming i am being asked by my people to import the gui into another class and in that other class i am supposed to define the event handler methods of my gui. i've never seen anything like it so could someone please show me an example plz import ...

98. importing info from one class into a gui    forums.oracle.com