Tomas1122, on 03 October 2012 - 09:02 PM, said:
Never mind i got that working




Posted 04 October 2012 - 03:38 AM
Posted 04 October 2012 - 11:11 AM
pbl, on 04 October 2012 - 03:38 AM, said:
Posted 04 October 2012 - 12:24 PM
pbl, on 04 October 2012 - 11:49 AM, said:
JTable t = new JTable(names, header);
add(new JScrollPane(t));
class MyTable extends JTable implements TableCellRenderer {
MyTable() {
super(new MyModel());
}
public TableCellRenderer getCellRenderer(int row, int col) {
return this;
}
public Component getTableCellRendererComponent(JTable arg0,
Object component, boolean focus, boolean arg3, int arg4, int arg5) {
return (Component) component;
}
}
Posted 04 October 2012 - 12:34 PM
Posted 04 October 2012 - 12:45 PM
pbl, on 04 October 2012 - 12:34 PM, said:
JTable t = new JTable(names, header);
add(new JScrollPane(t));
class MyTable extends JTable implements TableCellRenderer {
MyTable() {
super(new MyModel());
}
public TableCellRenderer getCellRenderer(int row, int col) {
return this;
}
public Component getTableCellRendererComponent(JTable arg0,
Object component, boolean focus, boolean arg3, int arg4, int arg5) {
return JLable;
JLabel opaque(true)
}
}
Posted 04 October 2012 - 01:22 PM
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
* @author Shashi Suthar
*/
public class Names extends JApplet implements ActionListener {
JButton[] button;
JLabel[] label;
int[] nbClick;
// Applet init method that will init the JComponent
// will be called automatically when running an Applet
// will be "manually" called by main() when running as an application
@Override
public void init() {
// create the buttons and the labels that display how many
// time the buttons were clicked
button = new JButton[2];
label = new JLabel[button.length];
nbClick = new int[button.length];
// as a gridLayout of number of buttons X 2 for their corresponding labels
setLayout(new GridLayout(button.length,2));
for(int i = 0; i < button.length; i++) {
// create button
button[i] = new JButton("Button #" + (i+1));
button[i].addActionListener(this);
add(button[i]);
// and its corresponding label
label[i] = new JLabel(" Nb click: 0");
add(label[i]);
}
}
@Override
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public class Names extends JFrame {
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
