Element « GUI « Java Swing Q&A





1. How can I set distance between elements ordered vertically?    stackoverflow.com

I have code like that:

    JPanel myPanel = new JPanel();
    myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));

    JButton button = new JButton("My Button");
    ...

2. How can I put a horizontal line between vertically ordered elements?    stackoverflow.com

I have a set of vertically ordered elements. They are displayed with the following code:

JPanel myPanel = new JPanel();
myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));
JButton button = new JButton("My Button");
JLabel label = new JLabel("My label!!!!!!!!!!!");
myPanel.add(button);
myPanel.add(label);
I ...

3. How do I synchronize GUI-Elements?    stackoverflow.com

I have a little problem with my java-program. I wanna use Observer, to synchronize two GUIs. But I can't synchronize the JComponent / JButton elements. For example: I have a GUI-Class which implements ...

4. How to capture a Swing GUI element?    stackoverflow.com

Can I capture only an element of a Swing GUI (e.g. a JPanel containing some JTextFields)?

5. Closing all possible GUI related elements    stackoverflow.com

Is there a way to close (or get a handle to) all possible windows, dialogs, prompts, etc. created with Java? I have an app that creates GUI elements here and there ...

6. Apache Pivot: BoxPane with one filling element    stackoverflow.com

Can I make a BoxPane (for example vertically) where one of the components within the BoxPane fills the avaible space? For example here I would like the ScrollPane to take all avaible ...

7. Java read and save GUI elements    stackoverflow.com

I have a question regarding accessing GUI elements. For example having a simple GUI program on Java, how can I read and save the Swing GUI elements hierarchy on a tree ...

8. Renaming elements/items in a List    coderanch.com

9. Setting to the default element    coderanch.com





10. get Element by the current CaretPosition    coderanch.com

import java.awt.BorderLayout; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.text.Element; import javax.swing.text.html.HTMLDocument; public class HTMLTest extends JFrame { public HTMLTest() { getContentPane().setLayout(new BorderLayout()); JEditorPane pane = new JEditorPane("text/html", "

  • something
" ); getContentPane().add(pane, BorderLayout.CENTER); pack(); setVisible(true); HTMLDocument doc = (HTMLDocument)pane.getDocument(); Element root = doc.getDefaultRootElement(); for(int i = 0; i < root.getElementCount(); i++ ){ Element e = root.getElement(i); System.out.println(e.getName()); if(e.getName().equals("body")) { for(int j = 0; j ...

11. Change attribute of UL element    coderanch.com

12. GUI compiles but isn't showing all elements    coderanch.com

Hi , I have this GUI and it compiles fine , but when i test it i get only the "Beenden" and "Berechnen" buttons? Maybe someone can point out my mistake? import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.border.TitledBorder; @SuppressWarnings("serial") public class TaschenrechnerGUI extends JFrame{ ...

13. adding and manipulating elements of a CCombo    coderanch.com

Hi all, I am using SWT designer. I wanted to make an item , that allow me to add elements to it. And each time I wanted to add an element I wanted that a dialog appears asking me to enter the element; of course after clicking on it. myItem = new CCombo(shlBusinessProcess, SWT.BORDER); myItem.addMouseListener(new MouseAdapter() { public void mouseDoubleClick(MouseEvent e) ...

14. Can I add elements to a Java GUI?    java-forums.org

Java Code: import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Color; import javax.swing.JLabel; import javax.swing.JTextField; import java.awt.Font; public class DynamicGui extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { DynamicGui frame = ...

15. Structuring GUI elements and eventlisteners    java-forums.org

Hi, I have a class that contains a lot of GUI objects, and a lot of eventlisteners. To structure my application better, I would like to split this class into several classes, where each class represents one type of GUI elements (e.g. a certain type of buttons). I would of course also need one main class that puts it all together. ...

16. urgent Vector element to GUI    forums.oracle.com

while(rs.next()) { for(int i = 0; i < column; i++) { float temp = rs.getFloat("temp"); tempe.add(temp); break; } } this will return a list of elements in vector. -System.out.println("The elements at position 2 is: " + tempe.elementAt(2)); this will print element 2 in vector onto console. what should i do to print the same thing into textfield. TQ