jrookie

Greenhorn
+ Follow
since Aug 20, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jrookie

use GridBagLayout becouse it's haven't limit for cells
if use GridLayout you must define how many rows and cols
21 years ago
hi
in gridBagLayout you use GridBagConstraints
so ... when you need make new row
just use field GridBagConstraints.REMAINDER
if you don't use it all your components will locate ONE row and number of columns will equal your number of components
21 years ago
i think you wanna set some data in frame from your menu. so why you not put this data in frame and use frame.repaint()?
21 years ago
hello
i have mysql table with type "YEAR"
and i getColumnTypeName for it
it's return "UNKNOWN"
sql.Types don't support this type
how i can use it ???
thanks
this topic is closed
problem is fixed
21 years ago
Hello
i get java.lang.ArrayIndexOutOfBoundsException
and i don't understand it why...
code open only one table (6 rows and 6 columns), all anothers show this exception.
structure of all tables equals. Different rows only
i put in code strings
System.out.println("====Element=== "+ud.columns[2].elementAt(0));
System.out.println("====Element=== "+ud.columns[3].elementAt(0));
for test. they showing right data...
so why tables show this exception ?
code is
public void setDataModel(UserData ud)
{
this.ud=ud;
this.cols=ud.cols;
this.rows=ud.columns[0].size();
this.columnnames=ud.columnnames;
this.columntypes=ud.columntypes;
this.usertable=null;
this.usertable=new Object[cols][rows];
System.out.println("cols="+cols+" rows="+rows);
for (i=0;i<rows;i++)
{
for (j=0;j<cols;j++)
{
System.out.println("====Element=== "+ud.columns[2].elementAt(0));
System.out.println("====Element=== "+ud.columns[3].elementAt(0));
System.out.println("i="+i+" j="+j);
usertable[i][j]=ud.columns[j].elementAt(i);// <- here is exception
System.out.println("element="+usertable[i][j]);
}
}
}
public int getColumnCount()
{
return (cols);
}

public String getColumnName(int cols)
{
return (columnnames[cols]+"\n"+columntypes[cols]);
}

public int getRowCount()
{
return (rows);
}

public Object getValueAt(int rows,int cols)
{
return (usertable[rows][cols]);
}
21 years ago
hello
i wanna get coordinates of button in Applet. I use getLocation for each button but
it's always return equal data for all buttons (like "x=25 y=126").What's wrong ?
here is code
import java.util.*;
import java.io.*;
import java.applet.*;
import java.awt.Component.*;
public class ResumeApplet extends Applet implements ActionListener
{
Button b1,b2,b3;
Point p;

public void init()
{
b1=new Button("b1");
b2=new Button("b2");
b3=new Button("b3");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
add(b1);
add(b2);
add(b3);
}

public void actionPerformed(ActionEvent e)
{
Object obj;
obj=e.getSource();
if (obj==b1)
{
p=b1.getLocation();
System.out.println("b1: x="+p.x+" y="+p.y);
}
if (obj==b2)
{
p=common.getLocation();
System.out.println("b1: x="+p.x+" y="+p.y);
}
if (obj==b3)
{
p=common.getLocation();
System.out.println("b1: x="+p.x+" y="+p.y);
}
}

public void paint(Graphics g)
{
}
}
21 years ago
hello
i have 3 questions about JTable
1) how change column background color ?
2) how i can set column header multi line ?
3) how make auto resize columns ? some cells have a lot of data and it's ended by "..." until i don't resize this column.how make it automatic ?
thanks
21 years ago
try use
import javax.swing.*;
just "swing" - "s" must be lower case
21 years ago
i make empty JList
like that
JList list=new JList();
and i get Vector after some actions
can i put Vector in this JList ?
21 years ago
how i can use constructor in inner anymous class ?
21 years ago
inner class are good
but if you need set some parameters or get them from this inner class
how you make it ?
thanks
[ August 23, 2002: Message edited by: jrookie ]
21 years ago
hello
i written my own code, it's working but just want know what think another people about actionPerformed() method
i can build it only that way ? (i don't need inn classes)
public class MMT extends JFrame implements ActionListener
...
m11=new JMenuItem(m11s);
m11.addActionListener(this);
m12=new JMenuItem(m12s);
m12.addActionListener(this);
m13=new JMenuItem(m13s);
m13.addActionListener(this);
...
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==m11)
{
System.out.println("hello m11");
}
if (e.getSource()==m12)
{
System.out.println("hello m12");
}
...
}
21 years ago