Object « GUI « Java Swing Q&A





1. How to @Inject into existing object hierarchy using Guice?    stackoverflow.com

I have an existing object hierarchy where some objects have fields that need to be injected. Also there are some other objects that are constructed using Google Guice and ...

2. Grouping swing objects    stackoverflow.com

I want to make an object I can add to my java swing application. The object when instantiated would contain an image and 2 labels - is there a way to do ...

3. Can you cast an object to one that implements an interface? (JAVA)    stackoverflow.com

Can you cast an object to one that implements an interface? Right now, I'm building a GUI, and I don't want to rewrite the Confirm/Cancel code (A confirmation pop-up) over and ...

4. Some problems with home made gui objects    forums.netbeans.org

Hello I am using nb 6.7.1 on a pretty much up to date Ubuntu 9.10. I have two, perhaps related problems: 1) I have need for a cardLayout JPanel. No problem ...

5. Matisse: extends the gui object    forums.netbeans.org

Hi, if I use matisse to do, for exemple, a panel, matisse generates un source code with : public class MyGUIPanel extends JPanel And, in the properties, at code generation, I can see "Bean Class: class javax.swing.JPanel". OK. If I don't want to extend MyGUIPanel from JPanel, I can modify the source - the line "public class MyGUIPanel extends JPanel" is ...

6. Table Object    coderanch.com

7. How to create an OLE object in Java,    coderanch.com

8. Disappearing object    coderanch.com

Okay, my question isn't exactly about how to use Swing or AWT, but this IS a GUI app. Somehow, one of my member variables becomes null when it should actual refer to an object. So...here are some details. I have a plethora of classes in this program: LifeFrame - extends JFrame and initializes the GUI LifePanel - extends JPanel and contains ...

9. How to determine object type.    coderanch.com





10. Finding an objects index in a list?    coderanch.com

I have a Jlist whose list model is built with an array of objects. I have another aray of objects that is a subset of the first array (in other words the list might have objects 1-7 and the subset array has objects 2, 4, and 6). I would like to select all of the indexes of the objects in the ...

11. Passing objects    coderanch.com

Hi. I have created two classes that extend JPanel. These JPanels are placed on a JTabbedPane. One of these classes represents a 'Project Maintenance' tab. The other represents an 'Order Maintenance' tab. These two classes each have a combo box on them that contains project ID's. I want to be able to re-populate the data in this combo box on the ...

12. Disposing of Objects    coderanch.com

13. Transferrable object    coderanch.com

14. animating objects    coderanch.com

15. cut & paste objects    coderanch.com

Hi, Actually I couldn't use drag and drop. I want to transfer an object from a Java application running inside a ICA Client to a Java application started on the local machine. My knowledge is that drag and drop won't work but there is support for cut and paste (of just text?). I thought that I could use that to cut ...

16. 2Dgraphics object    coderanch.com

hi all, I have created a graphic object using the drawPolygon(). The object is drawn on a frame. Is it possible to save that 2D graphic object in some image file format so that when i open the file, that image will appear in the frame. Something similar to a workspace for u to load your document in it. AWT newbie ...





17. Movable object    coderanch.com

18. How do I know which object is selected?    coderanch.com

Hi, I have a JTree which is made up of nodes (Tests) and leaves(test steps) when the user clicks on the tree I need to know which item has been selected. However my problem is I am having to cast the selected node to enable me to use it, but obviously need to cast it inot the correct object. I have ...

19. There is a Line Object?    coderanch.com

Hello! I am working in a modeling tool and I need to implement a association between two elements. I tried to use the method "drawLine" from Graphics class, but it does not work as I would like. The line constructed is only many pixels drew. I would like to have a object to draw the line, that I can move it ...

20. Reusing the same objects in swing    coderanch.com

21. Swing object persistence    coderanch.com

Hello, I'm wondering if there's an alternative, more efficient way of doing something I'm trying to do: I have a class which generates a frame, which in turn contains two panels. The panel on the right contains a combobox which, when selected, changes the image in the left panel. Right now for things to work properly, I have to pass the ...

22. Killing...removing object    coderanch.com

Hi, I currently have an applet that displays a circle object on the screen when i press a button. Whenever I press the button again, it is suppose to clear any circles on the screen and draw a new one. But I can't seem to remove the first one, it just draws it on top of the other one. I'm using ...

24. Object serialisation & GUI    coderanch.com

Howdy to all, Not too sure if this is a Swing or an I/O serialisation issue. So I'll take my chances and post here. I have 3 classes: 1) PostcodeStream - essentially writes and reads a PostcodePanel object. 2) PostcodePanel - sets up a list (JList) of cities and postcodes. 3) PostcodePanelTest - the application. This application should allow you to ...

25. Setting X and Y of swing Object    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

26. Moving an object such as an arc.    coderanch.com

Heres my code: import java.awt.*; import java.applet.Applet; /* God Slime Volleyball Created By: Martin vanPutten Original Slime Volleyball Created By: Quin Pendragon (Fractoid) and Daniel Wedge (Wedgey) */ public class Slime extends Applet { // Slime Applet. private Graphics g; private int P; private int C; private int x; private int y; boolean Game = true; public boolean KeyPressed (Event Initialize, ...

27. Object meaning    coderanch.com

Should be asked on the beginners' forum. It measn the same as "object" in other object-oriented languages, eg Eiffel, C#, Simula. It measn a computerised representation of "something" which has data (attributes, in Java called fields) and behaviour (it does something, which in Java is expressed through its methods). What colour is a car? "car" means a "class." "A car" is ...

28. Movable Objects    coderanch.com

Hi there I have a JFrame with a JPanel placed on it. The JFrame is 400x400 and the JPanel is 300x300. I now want to put an object on the panel ie, a rectangle in horizontal position sized at a height of 50 and length of 100. Basically the JPanel is to be imagined as a 6x6 grid. Its the beginning ...

29. Object won't be removed    coderanch.com

30. How to move this object around?    coderanch.com

I tried to add the x and y coordinate in different places in the g.drawLine and it doesn't move. I have the correct picture but I need it to move. drawPict(g, 50, 20, 40,40,8); public void drawPict(Graphics g, int x, int y, int width,int height, int numSpokes) { double spokeX; double spokeY; //how to move this piece around for (int i ...

31. replacing objects in diff sized monitors    coderanch.com

Hi Sunil. Welcome to the ranch. We are happy to have you here By "swing objects" I take it you mean all the components which have been added to the frame/window. Usually one uses layout managers to define the relative positions of components in its container (as opposed to using a null layout manager and specifying absolute positions using the setBounds() ...

32. MutableTreeNode that does not allow duplicate Objects    coderanch.com

That would be overloading. You would need to check if the argument is an instance of DogNode, and throw an IllegalArgumentException if it isn't. Also, do the same for setUserObject - if you don't then changing the object will be possible. Perhaps you want to make sure the object is only set once: public void setUserObject(Object object) { if (getUserObject() != ...

33. Focuse object    coderanch.com

34. Visualizing instances of objects and their relationship    coderanch.com

Hi, I am trying to draw a picture of the relationships between different libraries. I created a library class, each instance represents a library I found in the code tree. The Library class has a hashmap which holds references to the other libraries. I have my Universe of Libraries created and I can run crude reports (System.out.println) but I would really ...

35. Tracking Multiple Objects    coderanch.com

36. handling rect objects!    coderanch.com

37. Calender Object    coderanch.com

> Suppose i hava a java interface with text field along with a button.When i press button,a small calender apear in GUI where i can choose date and the date set in text field. OK, that's what you want, so, re-read reply #1 unless you want someone to write the code for you, in which case try rent-a-coder

38. How to get object from one class to another class?    coderanch.com

So, I am working on a java project which includes a JFrame with 4 JPanels (North, Center, East, South). I also created a class (Total) with a getter, a setter, and a toString method. So if i created an object in the east panel ( muffin) and then i set the value of muffin to 12 (so the code i put ...

39. Making different graphical objects    coderanch.com

Hi, I want to make different graphical objects, but I've hit a snag. The master plan is to write my own cribbage program, so I want to have a green background (the convention for card games by Microsoft), but I can't seem to put anything on that background. Here's the code for the green background: import javax.swing.*; import java.awt.*; public class ...

40. Home-Made GUI Object    java-forums.org

:confused: Okay so lets say I have the class Combatant. Combatant is made up of a bunch of stats, hp, def, atk, blah blah blah. I want a gui component that can represent this object, but only one instance. Like it's a combo of a bunch of jlabels. Would extending this class to a JPanel and then adding that panel to ...

41. Accessing GUI object methods    java-forums.org

Where do you declare the canvas1 variable? Are you sure that it's declared as a GamePanel object and not a JPanel object? Also, why are you mixing AWT and Swing components together? You're much better off sticking with all-Swing components. Most here will recommend that you ditch the NetBeans code-generation and code Swing by hand. Then you can access anything and ...

42. need help setting up GUI objects    java-forums.org

Java Code: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JPasswordField; import javax.swing.JOptionPane; public class GUI2 extends JFrame { private double textField1; private double textField2; private JTextField field2; private JTextField field3; private JLabel label1; private JLabel label2; private JLabel resultLabel; private JButton button; private double resultNumber; public GUI2() { super("Title"); setLayout(new FlowLayout()); ...

43. GUI Objects    java-forums.org

45. GUI and making an object    forums.oracle.com

JTextArea txtPayroll = new JTextArea("Deze toepassing berekent het salaris van een werknemer.\n" + "Geef eerst de naam van de werknemer in (Familienaam Voonaam).\n" + "Vul daarna de juiste salarisgegevens in.\n" + "Vul tenslotte de code in:\n" + " Code 1 voor arbeiders (uren en uurloon invullen)\n" + " Code 2 voor bedienden (wedde invullen)\n" + " Code 3 voor kaderleden (wedde ...

46. Is it possible to overlap objects in a GUI?    forums.oracle.com

The problem is I have a 9x9 sudokugrid which consists of an array of buttons, the buttons are printed out using a GridLayout(9,9) row by row (it needs to be done this way for them to be named etc correctly). The first problem is I can't seem to force the size of each button with setSize(), so to make them actual ...