The Artima Developer Community
Sponsored Link

Java Answers Forum
newbie here. jtable, combo box question

2 replies on 1 page. Most recent reply: Apr 7, 2002 5:59 PM by Brian Vondette

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Brian Vondette

Posts: 2
Nickname: yngdude
Registered: Apr, 2002

newbie here. jtable, combo box question Posted: Apr 7, 2002 5:17 PM
Reply to this message Reply
Advertisement
I am writing a ap that had 2 panels. the first panel contains 2 combo boxes and an enter button. when the enter is clicked, a jtable is drawn in panel2. My question is that once the jtable is drawn, I can't get the combo boxes to allow me to make a different selection. hopefully someone can help.


Kasim Hanif

Posts: 11
Nickname: kasim
Registered: Apr, 2002

Re: newbie here. jtable, combo box question Posted: Apr 7, 2002 5:42 PM
Reply to this message Reply
if u cand send some code i mite be able to help

Brian Vondette

Posts: 2
Nickname: yngdude
Registered: Apr, 2002

Re: newbie here. jtable, combo box question Posted: Apr 7, 2002 5:59 PM
Reply to this message Reply
panel2.setLayout(new java.awt.BorderLayout());



jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, Months[month], null, null, null},
{"Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday","Saturday"},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null}
},
new String [] {
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false
};

public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
String monthName=Months[month];
int daysInMonth=DaysInMonth[month];
jTable1.setRowHeight(50);

int DOW=FirstOfMonth(year,month)-1, Date=1, Row=3;


for (;Date<daysInMonth+1;Date++, DOW++) {
if (DOW==7) {
DOW=0;
Row++;
}
Integer DateInt= new Integer(Date);
jTable1.setValueAt(DateInt, Row, DOW);
}




panel2.add(jTable1, java.awt.BorderLayout.CENTER);
getContentPane().add(panel2, java.awt.BorderLayout.CENTER);

pack();

Flat View: This topic has 2 replies on 1 page
Topic: How to print in landscape? Previous Topic   Next Topic Topic: GridBagConstraints

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use