Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Java
  4. How do i get all values from a JTextfields that is located on another JInternalFrame?

How do i get all values from a JTextfields that is located on another JInternalFrame?

Scheduled Pinned Locked Moved Java
questioncsharphelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    miceisland
    wrote on last edited by
    #1

    Hi All, I am having problem getting values from jinternalframe, what i am doing is i got a JFrame that opens multiple JInternalFrame with JTextfield in it, now i want to get all the JTextfield value in the JInternalFrame, i need the function to be in the JFrame, is this possible, if not any recommendation is appreciated. Thanks. Stephen Michael

    --------------------- www.islasolutions.net

    4 1 Reply Last reply
    0
    • M miceisland

      Hi All, I am having problem getting values from jinternalframe, what i am doing is i got a JFrame that opens multiple JInternalFrame with JTextfield in it, now i want to get all the JTextfield value in the JInternalFrame, i need the function to be in the JFrame, is this possible, if not any recommendation is appreciated. Thanks. Stephen Michael

      --------------------- www.islasolutions.net

      4 Offline
      4 Offline
      4277480
      wrote on last edited by
      #2

      In this code I show you the way to get the value for one all you need to do next is a simple loop to get the other values. This can be done by keeping a counter for the number of internal frames you have (make sure the JTextFields have consistent naming) then use a for loop to concatenate the values and display them in the label.

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class InternalFrameExample extends JFrame
      {
      JLabel l;
      JInternalFrame g;
      JTextField t;
      JButton b;
      // the counter of frames
      public InternalFrameExample()
      {
      g = new JInternalFrame();
      t = new JTextField();
      g.add(t, BorderLayout.NORTH);
      g.setVisible(true);
      g.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      l = new JLabel();
      b = new JButton("poke");

      	b.addActionListener(new ActionListener() 
      	{
      		public void actionPerformed(ActionEvent e) 
      		{
      			//the for loop and concat goes here
      			l.setText(t.getText());
      		}
      	});
      
      	add(l, BorderLayout.NORTH);
      	add(b, BorderLayout.SOUTH);
      	add(g, BorderLayout.CENTER);
      	
      	setTitle("InternalFrameExample");
      	setVisible(true);
      	setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE);
      	setSize(400, 400);
      }
      
      public static void main(String\[\] args) 
      {
      	new InternalFrameExample();
      }
      

      }

      Hope this helps

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups