Container « Container « Java Swing Q&A





1. How to disable a container and its children in Swing    stackoverflow.com

I cannot figure out a way to disable a container AND its children in Swing. Is Swing really missing this basic feature? If I do setEnabled(false) on a container, its children are ...

2. Iterate / recurse through Containers and Components to find objects of a given class?    stackoverflow.com

I've written a MnemonicsBuilder class for JLabels and AbstractButtons. I would like to write a convenience method setMnemonics( JFrame f ) that will iterate through every child of the JFrame ...

3. What is the use of Container in Swing?    stackoverflow.com

What is the use of Container in Swing?

4. What is the purpose of "Container c=getContentPane();" in Swing?    stackoverflow.com

import java.awt.*;
import javax.swing.*;
public class 
import javax.swing.*;
import java.awt.*;
import javax.swing.tree.*;
import javax.swing.event.*;
/*<applet code="JT.class" width=200 height=300>
</applet>*/
 
public class JT extends JApplet {
    JTree tree;
    JTextField box;
    Object ...

5. How can I enclose a component with another container at runtime?    stackoverflow.com

What I'm trying to achive is basically the "Enclose in" feature of Netbeans at runtime: Let's say I have this component hierarchy:

Container
    Label 1
    Label 2
 ...

6. Who loads javax.swing.* classes in Equinox osgi container?    stackoverflow.com

I read some equinox code and doc. I came to understand that, at present, only class loading for java.* packages are delegated to the parent classloader(given that i have not modified ...

7. how to reuse the area in a container when any component is removed from it?    stackoverflow.com

i hav a panel and i m trying to remove labels from it which were added to it during run-time. but when labels are removed succesfully i m not able to use ...

8. Java Container constraints question    stackoverflow.com

I am using the following:

java.awt.Container.add(Component comp, Object constraints)
How do I specificy the constraints object? I need to be able to place a component within the container. Oh and my class extends ...

9. setCursor on container without it changing cursor of sub components    stackoverflow.com

JPanel panel = new JPanel(null);
panel.setSize(400, 400);
panel.add(new JButton("Test"));
panel.setCursor(Cursor.getCursor(Cursor.SOMETHING_SOMETHING_CURSOR));
The panel will have a custom cursor, but I don't want the button to have a custom cursor. I don't want to have to set ...





10. Netbeans Matisse GUI Builder ... separate GUI containers in more than one class?    stackoverflow.com

By default, Netbeans will create all of your drag and drop components into a single class file. I am using a JPanel with 3 tabs. I would like to ...

11. Java - Displaying a title within a contentPane Container    stackoverflow.com

I am a newbee so advise and help is always greatly appreciated. Cannot seem to get my container contentPane to display the title. My code:

class CreateStockCodeDetails extends JFrame implements ActionListener
{

    ...

12. Does Container.getComponents() return references to the original components?    stackoverflow.com

I'm using Container.getComponents() to get an array of Components stored inside the Container. I'm then modifying one of these Components (which happens to be a JLabel), but the changes are not ...

13. Swing Containers and Controllers don't abide by the settings applied to them?    stackoverflow.com

I'm using Netbeans 7 and I'm running into the most unusual situations when designing the Swing Containers and Controllers. For some unknown reason and at some situation the Containers or ...

14. In Java Swing is it necessary to always have a Container?    stackoverflow.com

I am new to Swing. There is a silly question that I have. It seems that every Swing code must have a container since all of JFrame, JWindow, etc are all ...

15. Java. Swing. Changing of component's order in a container    stackoverflow.com

I'm using java Swing. I've created JPanel and filled it with Components.

JPanel panel = new JPanel();
for (JComponent c : components) {
   panel.add(c);
}
I need to change order of some components. ...

16. URL's within a container    coderanch.com

Hi, I hope someone can help me with this trivial question. I'm just trying to put a URL into a container so it will be clickable for a user. I realize that a container's add methods does not take URL's, but how do I add a URL to a container? At the moment, I have the URL as a string on ...





17. Container focusLost    coderanch.com

When you have a container with a number of child components, how can the container detect if the focus that was on one of the child components moved to a component outside the container. The container does not have to know which of the components inside the container lost the focus and which component outside the container got the focus, allthough ...

18. AWT - Containers    coderanch.com

19. GridaBagLayout and Container    coderanch.com

20. Wrapping components in a container    coderanch.com

I have a container (applet or frame) that contains a main panel in it. I set the layout of the main panel to BorderLayout and add another panel to the SOUTH and a component/panel to the CENTER. The bottom panel has FlowLayout and I add several labels to it. When i display this, only some lables are displayed. What I want ...

21. how to make a irregular container    coderanch.com

22. Why Container?    coderanch.com

23. Component Container    coderanch.com

In my application I have severl Components (JTextFields, JTextAreas, etc). I am going to need to hand these all over to another class for manipulation and I thought that if I just shoved all these in a Container (Hashmap, HashTable, etc) then I could just hand that over to the other class. But what container would anyone suggest I use for ...

25. Display HTML content in Swing containers    coderanch.com

Hi folks, I have a straight forward posting to you guys which really need a quick reply. I have a html page running on my server. Can i simply use any Java Swing container to display that HTML page rather than any browser. If yes? how to go about it? regards, karthik

26. AWT Containers Help    coderanch.com

27. what container can contain object?    coderanch.com

28. Rebuilding a Container    coderanch.com

29. how to update container    coderanch.com

30. Container context    coderanch.com

31. How to list all visible containers    coderanch.com

Hi there I have a situation where I need to close all open JFrames in my program. The approach that I want to take is to somhow get a list of them and then run through the list and dispose of them one by one. (I do want to dispose and not just hide). Does anyone know how I can list ...

32. Class Container not found :(    coderanch.com

33. container components not removed    coderanch.com

I have a class that extends JFrame, and uses contentPane to create a pane with various components. (I'm leaving out all of the fields to keep this brief) //create window to get from units public void fromUnitWindowOptions(){ //Set JFrame at center of the screen Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); double width= scrnsize.getWidth(); double height = scrnsize.getHeight(); this.setLocation((int)width/2 -240,(int) ...

34. Container not displaying.    coderanch.com

36. Container    coderanch.com

37. information from a container    coderanch.com

Hi, I have a container with a number of components in it, JPanels and the like. I would like to take note of a number of things when the user closes the container (get the time in milisec for instance). Is it possible to access this information? eg. something like Container.onClose(){ getCurrentTimeMilis() } ??? How does one monitor the container being ...

38. Containers and getContentPane()    coderanch.com

Wasn't sure if here, or in the GUI section, was the best place for this... Can anyone point me toward either a couple good internet resources, or books (beginner/intermediate level) that touch on Swing and GUI stuff? I'm especially struggling with Containers and the whole getContentPane() concept. Said another way, I'm unsure about when to use a container, and how it ...

39. container's containment    coderanch.com

a specific component can only be in one place at a time. run this and the button will end up added to the final panel only import javax.swing.*; import java.awt.*; import java.awt.event.*; class Testing { public void buildGUI() { JPanel[] panels = new JPanel[10]; JFrame f = new JFrame(); f.getContentPane().setLayout(new GridLayout(panels.length,1)); JButton btn = new JButton("OK"); for(int x = 0;x < ...

40. component and a container    coderanch.com

41. container sixe    coderanch.com

43. What does Container mean in Swing    coderanch.com

I have just starting using swing and am reading the sun homepage about swing .There while i was reading i encountered many places where the word container was used .Please can any one tell me what exactly is a container in Swing .I am familiar with Web technology and there container is a place were all the code like jsp/servlet reside.Is ...

44. retrieving name of container    coderanch.com

hello everyone. as the saying goes, i'm new so please have patience with my ignorance. i'm having a problem with a relatively simple idea. i'm creating a 10 question multiple choice quiz where a question is a class that extends JPanel and has (with the parameters in my constructor) it's own button group for answers and its own JLabel for the ...

45. awt container listeners    coderanch.com

46. Container with only one component    coderanch.com

47. Difference between the all containers    coderanch.com

48. Question about container class    coderanch.com

That's something different. LayoutManager.layoutComponent takes a Container so you can't use the frame. However, you should never call this method directly. Container.doLayout() is the way to go to force a re-layout. Again, you can't use this with the frame so you'll need its content pane. Note that if you add or remove controls during runtime invalidate() followed by repaint() is the ...

49. Which Container should I use?    coderanch.com

I have a GUI with a row of buttons across the top. Clicking one of those buttons will display a column of buttons down the left hand side. Clicking one of the column buttons will display a row of buttons across the bottom of the screen. Clicking on each button will also show a grid of data in a JTable displayed ...

50. Please explain to where container dimensions come from    java-forums.org

Hi, Well, I'm finally painting my JPEGs to the screen. I've got a question though about where the containers dimensions come from. I was using an example from a previous post to this group actually. I've extened JPanel with my own panel and the constructor looks like this: public PhotoViewer(BufferedImage bi) { mBuffImg = bi; mPanelSize = new Dimension(bi.getWidth(), bi.getHeight()); } ...

51. What is the lifetime (scope & visibility) of containers and their child objects    java-forums.org

When I say objects here, I'm referring to the Swing objects that correspond to "objects" on the screen. I'm using NetBeans and the "main" class for this program is quite lengthy (for the simple stuff I'm doing) and so hopefully the scaled down version I have below will suffice. So, as you know, there's a class in which is the main ...

52. Components as containers    java-forums.org

In a program i am designing i need to be able to add a jcomponent to a Jlabel. I have set the jlabel to opaque and I am able to change the background color. In addition, i am able to add a jlabel to another jlabel. However, i am unable to add any other jcomponents, such as jbutton or jtextfield, to ...