JFrame « JTextField « Java Swing Q&A





1. How to intercept keyboard strokes going to Java Swing JTextField?    stackoverflow.com

The JTextField is a calculator display initialized to zero and it is bad form to display a decimal number with a leading 0 like 0123 or 00123. The numeric buttons (0..9) ...

2. How to pass data from a JTextField to another JTextField    stackoverflow.com

I need to pass a text from a JTextField in a JFrame to a second JTextField in another JFrame. GUI has been created using GUI Editor netbeans 6.9.

3. Getting coordinates of a JTextField in a JFrame    stackoverflow.com

I've added a JTextField in a JFrame using the BorderLayout.
Now I want to know the location of the JTextField. I used getX() and getLocation(), but both gives me 0, which is not ...

4. How do i add values entered into TextFields in a JPanel to an array?    stackoverflow.com

I would like to add the values of "HouseNumber,StreetName,Town,Postcode" which are the textfields on my JPanel to the "Address" Array, What would be the best way to go about this? Thanks Main ...

5. It's possible pass a JFrame as parameter and I get the fields that I created?    stackoverflow.com

By example, I want to take the value from an JTextField. In the JFrame I can do this with a simple txtField.getText(), but how I do passing the JFrame like parameter?

static ...

6. How to have a dynamic width for a JTextField?    stackoverflow.com

I have a JFrame with a JTextField. I want to get the width of the JTextField increased/decreased accordingly when the JFrame is maximized/restored. How can I do that?

7. How can I add a JTextField to a JFrame's MenuBar?    stackoverflow.com

I've been trying to overload JMenu and put in some custom code to support a JTextField but that isn't going well. My main purpose here is to add a search ...

8. How to get a String from a Jframe (textfield) and put on another jFrame (txtArea)? - Netbeans - Well Explained    stackoverflow.com

it's my first post in here, but you have been helping me indirectly in many ways. But this kind of thing, like the title says, I still can't figure out. I think ...

9. How do I post new string into a JPanel text field after the initial value has been set?    stackoverflow.com

I am trying to understand how the JFrame stuff works. I am writing a program, that will read the contents of a file, and display it into the text-area in the ...





12. how to Add jtextfield in jframe ?    coderanch.com

hi , i want to create apps same as when we open a eclipse and we get " select workspace " frame. but i have to accpet only jar file. while doing so , i come accross issue for adding jtextfield to show path of jar in text filed. i tried like : JFrame x= new JFrame(); x.setVisible(true); x.setSize(400, 100); x.setAlwaysOnTop(true); ...

13. JTextField Not Displaying Properly When Backgrnd Image is set on jframe    go4expert.com

package firstTry; import java.awt.*; import javax.swing.*; public class Second extends JFrame { public JPanel mainpanel = new JPanel(); JLabel mainhead = new JLabel("Population Forecast Tool"); ImageIcon back = new ImageIcon("year2.jpg"); public JLabel backLabel = new JLabel(back); public Second() { mainpanel.setLayout(null); mainhead.setFont(new Font("Arial", 1, 20)); mainhead.setBounds(240,10,300,30); backLabel.setBounds(40,45, 627, 364); mainpanel.add(mainhead); mainpanel.add(backLabel); add(mainpanel); SecondComp obj = new SecondComp(mainpanel); } public static void main(String[] ...

14. launching Jframe from text field    java-forums.org

Hey I want to click on a textfield (i.e two clicks) so that this then opens up a jframe which i then enter text in using buttons to then add this data to the system. How do i go about opening the panel from the text field as i have the panel with the text entry complete. thanks

16. unable to clear text Field in Multi Screen JFrame GUI Application    java-forums.org

i am working with a Swing GUI project where I want to accept user input in a text field I have used singleton pattern which will create only one instance of object due to this when i move from one scree to another the input of textfield doesnt updated I have used setText method to clear the JTextField but it wont ...





17. Problem Loading JTextField in JFrame / Problema al cargar JTextField en JFrame    java-forums.org

Problem Loading JTextField in JFrame / Problema al cargar JTextField en JFrame Hello all, I have a problem when I load a JFrame. The JFrame has two JTextFields and two JButtons, when it opens the first JTextFields has the focus with "requestFocus()" function. The problem is that the focus is not allways gained well. Sometimes, when the JFrame is ...

19. Update Textfield between 2 jFrames    forums.oracle.com

CallingFrame=Parent; //code } there is an eventhandler in form 2 which looks after the ok button: private void jBtnSelectGPOKActionPerformed(java.awt.event.ActionEvent evt) { //call to form 1 method to update textfields here } So the parent frame reference gets transfered into the frame 2 constructor but how do I then use this in the event handler?? I declared a private variable in Form ...

20. JFrame JTextField layout    forums.oracle.com

You want to nest panels using different layouts for each type of panel. for now, I'd look at creating a series of small JPanels that uses flowlayout to hold anjust the jlabel and the jtextfield. Then a bigger panel can hold and stack the small jpanels with a gridlayout set to (0, 1). Again, look at the layout manager examples information ...

21. have i imported everything i need to for my jFrame and TextFields?    forums.oracle.com

ok thanks for the reply, but i think it should work liek that. its part of a tutorial for university work, and that is one of the examples so it should just be a case of writing it down n then running the code.but it doesn't work and its so frustrating! Did you cut and paste the example or type it ...

22. How to get the value of JTextField from one JFrame to a JApplet    forums.oracle.com

In the future Swing related questions should be posted in the Swing forum. First of all you should be using a JDialog for a popup, not a JFrame. If you want access to the data in the text field then you need a reference to the text field. So you do this by either a) keeping a reference to the text ...