Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

JButton not displaying properly

hello there,

i have a jtable in which i want to add button in one of the columns.my problem is the button size is very small. i dont know why.i have attached a screen shot.
tabs=new JTabbedPane();
		tabs.addChangeListener(this);
		
		//finishTable=new JTable();
		bulkTable=new JTable();
		packTable=new JTable();
		
//		Init tables models
		finishTableModel=new DefaultTableModel(){
			private static final long serialVersionUID = 1L;
 
			public boolean isCellEditable(int row, int column) {
				if(column==6)
				{
					return true;
				}else
				{
					return false;
				}
			}
		};
		finishTableModel.setColumnIdentifiers(new String[]{"","Cheque No.","Cheque date","Days left","Cheque amount","Comment","Action"});
		
		
		bulkTableModel=new DefaultTableModel(){
			private static final long serialVersionUID = 1L;
 
			public boolean isCellEditable(int row, int column) {
				if(column==5)
				{
					return true;
				}else
				{
					return false;
				}
			}
		};
		bulkTableModel.setColumnIdentifiers(new String[]{"","Cheque No.","Cheque date","Cheque amount","Comment","Action"});
		
		packTableModel=new DefaultTableModel(){
			private static final long serialVersionUID = 1L;
 
			public boolean isCellEditable(int row, int column) {
				return false;
			}
		};
		packTableModel.setColumnIdentifiers(new String[]{"","Cheque No.","Cheque date","Cheque amount","Comment"});
		
		
		
		finishTable=new JTable(finishTableModel);
		finishTable.setDefaultRenderer(Object.class,new CustomeTableCellRenderer()); 
		finishTable.setAutoCreateRowSorter(true);
		ButtonCell buttonCell=new ButtonCell(){
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;
 
			@Override
			public void actionPerformed(ActionEvent e) {
				super.actionPerformed(e);
				/*JComboBox jcb=new JComboBox(bankNameCBM);
				GUITools.fixFieldsWidth(150,jcb);
				int result = JOptionPane.showOptionDialog(finishTable, 
						jcb, "Deposit the cheque"
						, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null); 
		        if(result==JOptionPane.OK_OPTION)
		        {
		        	//moveToDeposit(finishTable.getSelectedRow());
		        }*/
			}
		};
		finishTable.getColumnModel().getColumn(0).setMaxWidth(40);
		finishTable.getColumnModel().getColumn(6).setCellRenderer(buttonCell);
		finishTable.getColumnModel().getColumn(6).setCellEditor(buttonCell);
		finishTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		finishTable.setColumnSelectionAllowed(false);

Open in new window

1.JPG
Avatar of Zolf
Zolf
Flag of United Arab Emirates image

ASKER


please help
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial