Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #4366 > unrolled thread
| Started by | "Sriram" <sriram@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:50 +0000 |
| Last post | 2011-04-27 15:50 +0000 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.java.gui
Valid entry JTable "Sriram" <sriram@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Valid entry JTable "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Valid entry JTable "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Valid entry JTable "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Valid entry JTable "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Valid entry JTable "Mark Space" <mark.space@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Valid entry JTable "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
| From | "Sriram" <sriram@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:50 +0000 |
| Subject | Valid entry JTable |
| Message-ID | <c926cc8e-2fdc-4995-8389-bf1467eaf90a@n1g2000prb.googlegroups.com> |
To: comp.lang.java.gui Hi Is it possible to get valid entries say for example a list of valid entries description in each cell of like the first two rows when the user keeps adding rows and the mouse selection is on an empty cell line after I click the Okaty button? Something like this -Valid entries Cell value at rowno1,colno1 is ...... cell value at rowno1 colno2 is... and so on.... Any references,sample code,links might help me Thanks Sriram --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:50 +0000 |
| Message-ID | <48f70b60$1@news.uni-rostock.de> |
| In reply to | #4366 |
To: comp.lang.java.gui Sriram schrieb: > Hi > > Is it possible to get valid entries say for example a list of valid > entries description in each cell of like the first two rows when the > user keeps adding rows and the mouse selection is on an empty cell > line after I click the Okaty button? Huh? Could you rephrase that? > > Something like this -Valid entries > > Cell value at rowno1,colno1 is ...... > cell value at rowno1 colno2 is... > > and so on.... maybe additionally to rephrasing a more sophisticated example would be nice. > Any references,sample code,links might help me > > Thanks > > Sriram --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:50 +0000 |
| Message-ID | <48f70fd8$0$24348$db0fefd9@news.zen.co.uk> |
| In reply to | #4366 |
To: comp.lang.java.gui Sriram wrote: > Hi > > Is it possible to get valid entries say for example a list of valid > entries description in each cell of like the first two rows when the > user keeps adding rows and the mouse selection is on an empty cell > line after I click the Okaty button? > That is a very long and confusing sentence. I'd find it easier to understand if you split it into several short sentences. Please also use terms that others are more likely to understand. What is a "valid entry"? Are you talking of the validation of the values in a field using something like an InputVerifier? Or do you just want to print to stdout the text values of some JTextFields? Or of some JTable cells? > > Something like this -Valid entries > > Cell value at rowno1,colno1 is ...... > cell value at rowno1 colno2 is... > > and so on.... > > Any references,sample code,links might help me > Did you just want to put some System.out.println statements in an ActionListener associated with your "Okay" JButton? -- RGB --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:50 +0000 |
| Message-ID | <48f715a2$0$24340$db0fefd9@news.zen.co.uk> |
| In reply to | #4368 |
To: comp.lang.java.gui
RedGrittyBrick wrote:
>
> Sriram wrote:
>> Hi
>>
>> Is it possible to get valid entries say for example a list of valid
>> entries description in each cell of like the first two rows when the
>> user keeps adding rows and the mouse selection is on an empty cell
>> line after I click the Okaty button?
>>
>
> That is a very long and confusing sentence. I'd find it easier to
> understand if you split it into several short sentences. Please also use
> terms that others are more likely to understand. What is a "valid
> entry"? Are you talking of the validation of the values in a field using
> something like an InputVerifier? Or do you just want to print to stdout
> the text values of some JTextFields? Or of some JTable cells?
>
>
>>
>> Something like this -Valid entries
>>
>> Cell value at rowno1,colno1 is ......
>> cell value at rowno1 colno2 is...
>>
>> and so on....
>>
>> Any references,sample code,links might help me
>>
>
> Did you just want to put some System.out.println statements in an
> ActionListener associated with your "Okay" JButton?
>
I made you a code ... but I eated it.
Coff:
-------------------------------------8<---------------------------------
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
/**
* @author: RedGrittyBrick
*/
public class LOL implements ActionListener {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new LOL().createAndShowGUI();
}
});
}
static final String MOAR = "MOAR!", K = "KTHXBAI";
private int rows = 3, columns = 2;
JTextField[][] array = new JTextField[rows][columns];
private void createAndShowGUI() {
JPanel p = new JPanel(new GridLayout(rows+1, columns));
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
array[row][column] = new JTextField(10);
p.add(array[row][column]);
}
}
p.add(makeJButton(MOAR));
p.add(makeJButton(K));
JFrame f = new JFrame("LOL");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(p);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
private final JButton makeJButton(String label) {
JButton b = new JButton(label);
b.addActionListener(this);
return b;
}
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if (command.equals(MOAR)) {
System.out.println("NOT WANT! (YET)");
} else if (command.equals(K)) {
for (int column = 0; column < columns; column++) {
for (int row = 0; row < rows; row++) {
System.out.println("Cell value at " + row
+ ", " + column
+ " is '" + array[row][column].getText()
+ "'.");
}
}
} else {
System.out.println("DOH!");
}
}
}
-------------------------------------8<---------------------------------
HTH (but somehow I doubt it)
--
RGB
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:50 +0000 |
| Message-ID | <nospam-FC854B.09504016102008@news.motzarella.org> |
| In reply to | #4369 |
To: comp.lang.java.gui In article <48f715a2$0$24340$db0fefd9@news.zen.co.uk>, RedGrittyBrick <RedGrittyBrick@spamweary.invalid> wrote: > RedGrittyBrick wrote: > > > > Sriram wrote: > >> Hi > >> > >> Is it possible to get valid entries say for example a list of > >> valid entries description in each cell of like the first two rows > >> when the user keeps adding rows and the mouse selection is on an > >> empty cell line after I click the Okaty button? > >> > > > > That is a very long and confusing sentence. I'd find it easier to > > understand if you split it into several short sentences. Please > > also use terms that others are more likely to understand. What is a > > "valid entry"? Are you talking of the validation of the values in a > > field using something like an InputVerifier? Or do you just want to > > print to stdout the text values of some JTextFields? Or of some > > JTable cells? > > > >> Something like this -Valid entries > >> > >> Cell value at rowno1,colno1 is ...... > >> cell value at rowno1 colno2 is... > >> > >> and so on.... > >> > >> Any references,sample code,links might help me > > > > Did you just want to put some System.out.println statements in an > > ActionListener associated with your "Okay" JButton? > > I made you a code ... but I eated it. Ate it? Ah, as in "the dog ate my homework." [...] > HTH (but somehow I doubt it) Well, your code compiles and runs! It sounds like you want to be able to add rows of data to a tabular data structure and get the data back later: a TableModel, if you will. Even if you don't use JTable to view your data, a TableModel is a way to encapsulate your data. You access your data externally though the get/setValueAt methods, and you can hide the actual implementation: an array or collection or whatever. In the past, I have used an extension of AbstractTableModel to generate random test data for a prototype. Here's some examples: <http://www.java2s.com/Tutorial/Java/0240__Swing/1020__JTable-Model.htm> -- John B. Matthews trashgod at gmail dot com http://home.roadrunner.com/~jbmatthews/ --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Mark Space" <mark.space@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:50 +0000 |
| Message-ID | <gd89i2$kj$1@registered.motzarella.org> |
| In reply to | #4371 |
To: comp.lang.java.gui John B. Matthews wrote: >> RedGrittyBrick wrote: >> I made you a code ... but I eated it. > > Ate it? Ah, as in "the dog ate my homework." It's a meme. Google for "lolcatz". <http://icanhascheezburger.files.wordpress.com/2007/01/2000035887522228730_rs.jpg> --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:50 +0000 |
| Message-ID | <nospam-0F5116.20492316102008@news.motzarella.org> |
| In reply to | #4372 |
To: comp.lang.java.gui In article <gd89i2$kj$1@registered.motzarella.org>, Mark Space <markspace@sbcglobal.net> wrote: > John B. Matthews wrote: > > >> RedGrittyBrick wrote: > > >> I made you a code ... but I eated it. > > > > Ate it? Ah, as in "the dog ate my homework." > > It's a meme. Google for "lolcatz". > > <http://icanhascheezburger.files.wordpress.com/2007/01/2000035887522228730_rs. > jpg> Ah, I have the dumb, but you have eated my confusion. -- John B. Matthews trashgod at gmail dot com http://home.roadrunner.com/~jbmatthews/ --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web