[lobby-svn] SF.net SVN: lobby: [255] trunk/src/org/lobby/client/LobbyClientGUI.java
Brought to you by:
yuranet
From: <yu...@us...> - 2007-07-22 23:13:03
|
Revision: 255 http://lobby.svn.sourceforge.net/lobby/?rev=255&view=rev Author: yuranet Date: 2007-07-22 16:12:59 -0700 (Sun, 22 Jul 2007) Log Message: ----------- some width Modified Paths: -------------- trunk/src/org/lobby/client/LobbyClientGUI.java Modified: trunk/src/org/lobby/client/LobbyClientGUI.java =================================================================== --- trunk/src/org/lobby/client/LobbyClientGUI.java 2007-07-21 05:34:15 UTC (rev 254) +++ trunk/src/org/lobby/client/LobbyClientGUI.java 2007-07-22 23:12:59 UTC (rev 255) @@ -66,6 +66,7 @@ import java.lang.reflect.Constructor; import java.net.URL; import java.net.URLClassLoader; +import java.awt.Insets; public class LobbyClientGUI extends JPanel implements ActionListener,LobbyClient,LobbyGameChatListener,TreeSelectionListener { // ,MouseListener,KeyListener @@ -215,9 +216,18 @@ games.getTableHeader().setReorderingAllowed(false); games.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + //games.addColumn(new javax.swing.table.TableColumn(0, 32)); + + games.getColumnModel().getColumn(0).setMaxWidth(32); + games.getColumnModel().getColumn(2).setMaxWidth(50); + games.getColumnModel().getColumn(3).setMaxWidth(50); games.getColumn("Action").setCellRenderer(new ButtonRenderer()); games.getColumn("Action").setCellEditor(new ButtonEditor()); - games.setAutoCreateColumnsFromModel(false); + + + + //games.setAutoCreateColumnsFromModel(false); games.setRowHeight(20); //gamesModel.addRow( getTableRow( new Game("myname",null,1,2,"ID STRING", Game.STATE_CAN_LEAVE) ) ); @@ -1389,9 +1399,11 @@ class GameTableModel extends DefaultTableModel { + private final String[] colnames = new String[] {"Icon","Name","Players","Action"}; + public GameTableModel() { - setColumnIdentifiers( new Object[]{"Icon","Name","Players","Action"}); + setColumnIdentifiers( colnames ); } @@ -1406,8 +1418,22 @@ games.repaint(); } - public Class getColumnClass(int c) {return getValueAt(0, c).getClass();} + public Class getColumnClass(int c) { + return getValueAt(0, c).getClass(); + + } + + public String getColumnName(int column) { + + return colnames[column]; + + } + + public int getColumnCount() { + return colnames.length; + } + // // public Object getValueAt(int row, int column) { // @@ -1428,6 +1454,11 @@ private JButton button = new JButton(); + public ButtonRenderer() { + + button.setMargin( new Insets(0,0,0,0) ); + } + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { @@ -1446,7 +1477,7 @@ public ButtonEditor() { button.addActionListener(this); - + button.setMargin( new Insets(0,0,0,0) ); } public void actionPerformed(ActionEvent ae) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |