-
Few Problems Help!
Hi 1
I'm Writing project in java and i have a few problems
1) when i write new class in different file it's show me that it the calss is not exits and i don't know what to how to fix it
2) how i convert an array to JTable or at least how i move all the data from the array to the JTable?
3) i want to show JButton and i write it and all and i add it to the panel when i run the program it doen't appear why?
thanks
1) code:
public void showNewWindow() {
JFrame You = new myForm(); --------> the other class
//Take care of the no window decorations case.
//NOTE: Unless you really need the functionality
//provided by JFrame, you would usually use a
//Window or JWindow instead of an undecorated JFrame.
if (noDecorations) {
You.setUndecorated(true);
}
//Set window location.
if (lastLocation != null) {
//Move the window over and down 40 pixels.
lastLocation.translate(40, 40);
if ((lastLocation.x > maxX) || (lastLocation.y > maxY)) {
lastLocation.setLocation(0, 0);
}
You.setLocation(lastLocation);
} else {
lastLocation = You.getLocation();
}
You.setSize(600,300);
You.setVisible(true);
}
3) b1 = new JButton("Show Time Table");
b1.setVerticalTextPosition(AbstractButton.CENTER);
b1.setBackground(Color.white);
b1.setFont(new Font("David", Font.BOLD, 24));
b1.setHorizontalTextPosition(AbstractButton.LEADIN G); //aka LEFT, for left-to-right locales
b1.setMnemonic(KeyEvent.VK_D);
b1.setActionCommand("disable");
b1.addActionListener(this);
add(b1, BorderLayout.PAGE_END);
-
first and third problems were solved
-
For the second, read the API for JTable (and if you need to get fancy, for DefaultTableModel)
db
-
For the JTable data i used the function setValueAt() ...
i have other problem ...
when i write for exaple:
Bina bina; Bina it's a class
or
Bina g = new Bina(values);
it's show me "cannot find Symbol class Bina
how i fix it?
thnxs!
-
import the class or place it in the same package...
i wonder how can you solve the question (1)