Article View: borland.public.jbuilder.java.swing
Article #10107Re: JB3 Bug? DecFrame + JTable cell renderer problems
From: Wendy Lin
Date: Fri, 19 Nov 1999 00:00
Date: Fri, 19 Nov 1999 00:00
143 lines
5108 bytes
5108 bytes
Sounds like you are running into Heavy weight vs Light weight
issues. DecoratedFrame is heavy weight and jdbTalbe or
JTable is light weight.
Here's URL on more information on what the problem with mixing
Heavy weight and light weight components.
http://java.sun.com/products/jfc/tsc/archive/what_is_arch/intro/intro.html
Here's the URL for bug submissions.
http://www.borland.com/devsupport/bugs/bug_reports.html
Hope this helps!
--Wendy
JBuilder QA
bl <blincoln@ssesco.com> wrote in message
news:3834C9F0.3AE307BE@ssesco.com...
> Where is the appropriate place to submit a bug report or look for other
> existing bug reports?
>
> I have been unable to get JB3 to allow me to put a combo box inside a
> table cell/column if I use DecoratedFrame as the top level frame. The
> programs compile and run, but clicking on the dropdown control causes
> a brief flash of the menu, it never becomes accessible.
>
> Here is the simplest version of the code I was able to create that shows
>
> the problem.
>
> Taking this code and simply replacing "DecoratedFrame" with "JFrame"
> and then adding the 2 appropriate "getContentPane()" calls, makes it
> work fine. The code here, when compiled on my system, will not let
> me access the ComboBox. Is there something I'm not understanding about
> the interactions between Swing components and JB components?
>
>
> thanks for any help,
> b
> blincoln@ssesco.com
>
> --
>
> import java.awt.*;
> import java.awt.event.*;
> import com.borland.jbcl.control.*;
> import com.borland.jbcl.layout.*;
> import javax.swing.*;
> import javax.swing.table.*;
>
> public class Frame1 extends DecoratedFrame {
> XYLayout xYLayout2 = new XYLayout();
> BevelPanel bevelPanel1 = new BevelPanel();
> BorderLayout borderLayout1 = new BorderLayout();
> JScrollPane jScrollPane1 = new JScrollPane();
> JTable jTable1;
>
> file://Construct the frame
> public Frame1() {
> try {
> jbInit();
> }
> catch(Exception e) {
> e.printStackTrace();
> }
> }
>
> file://Component initialization
> private void jbInit() throws Exception {
> jTable1 = new JTable(new MyTableModel());
> this.setLayout(borderLayout1);
> this.setSize(new Dimension(529, 360));
> TableColumn column = null;
> SetUpPopup(jTable1.getColumnModel().getColumn(3));
> bevelPanel1.setLayout(xYLayout2);
> this.add(bevelPanel1, BorderLayout.CENTER);
> bevelPanel1.add(jScrollPane1, new XYConstraints(16, 50, 468, 101));
> jScrollPane1.getViewport().add(jTable1, null);
>
> }
> file://File | Exit action performed
> public void fileExit_actionPerformed(ActionEvent e) {
> System.exit(0);
> }
> class MyTableModel extends AbstractTableModel
> {
> final String[] columnNames = { "A", "B", "C", "D", "E" };
> String [][] Data = { { "11","12","13","14","15"} ,
> {"21","22","23","24","25"} } ;
> public int getColumnCount() { return columnNames.length; }
>
> public int getRowCount() { return 2; }
>
> public String getColumnName(int col) { return
> columnNames[col]; }
>
> public Object getValueAt(int row, int col)
> { return Data[row][col];
> }
>
> public Class getColumnClass(int c)
> {
> return getValueAt(0, c).getClass();
> }
>
> /*
> * Don't need to implement this method unless your table's
>
> * editable.
> */
> public boolean isCellEditable(int row, int col)
> { return true; }
>
> public void setValueAt(Object value, int row, int col)
> { Data[row][col] = (String) value;
> }
> }
>
> public void SetUpPopup(TableColumn myCol)
> {
> file://Set up the editor for the Num Bytes cells.
> JComboBox JCB = new JComboBox();
> JCB.addItem("4");
> JCB.addItem("2");
> JCB.addItem("1");
> JCB.addItem("this is too");
> myCol.setCellEditor(new DefaultCellEditor(JCB));
> DefaultTableCellRenderer renderer = new
> DefaultTableCellRenderer();
> myCol.setCellRenderer(renderer);
>
> }
>
> public static void main(String[] args) {
> Frame1 frame = new Frame1();
> if (packFrame)
> frame.pack();
> else
> frame.validate();
> frame.setVisible(true);
> }
> }
>
Technical Details
Message-ID:
<8143bn$sok17@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3834C9F0.3AE307BE@ssesco.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,8a61be33a47042dd X-Google-Attributes: gid111d45,public From: " Wendy Lin" <wlin@borland.com> Subject: Re: JB3 Bug? DecFrame + JTable cell renderer problems Date: 1999/11/19 Message-ID: <8143bn$sok17@forums.borland.com> X-Deja-AN: 550628202 References: <3834C9F0.3AE307BE@ssesco.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: Borland X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing