We help IT Professionals succeed at work.

JButton not displaying properly

zolf
zolf asked
on
189 Views
Last Modified: 2011-10-19
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
Comment
Watch Question

Author

Commented:

please help
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.