Re: Mac OS X: Problems with custom widget in JTable



Felix Natter wrote:
I am using a simple "graph widget" (a subclass of JComponent that
overrides the paint() method) as a cell renderer in a simple
JTable.

This works fine on Linux and Windows (you see the /\ /\ in each cell),
but on Mac OS X (also with Java 1.6) the cells are empty (just plain
white window).

Others have addressed the main points, but I see another problem - you aren't doing GUI on the Event Dispatch Thread (EDT).

public static void main(String[] args) {
TestJTable5 frame = new TestJTable5();
frame.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
System.exit(0);
}
});
//frame.pack();
frame.setVisible(true);
}

All those GUI calls and constructors should be moved to the EDT, most easily by using java.awt.EventQueue.invokeLater() of a new Runnable around the calls in your main().

--
Lew
.



Relevant Pages

  • RE: Automatically move to new cell after keystroke
    ... The Event code calls procTestKey whenever a cell in column B is selected. ... 'Type to hold the Windows message information ... Const WM_KEYDOWN As Integer = &H100 ... translate the virtual key code to a character code ... ...
    (microsoft.public.excel.programming)
  • RE: automatically insert row
    ... than one row gets inserted if I keep making changes to that one cell. ... make sure the VBA editor is not ... > giving you any error messages. ... But sometimes these newsgroup windows ...
    (microsoft.public.excel.programming)
  • Re: Tab key equivalent in Excel.
    ... Both macros are designed to do the same thing but note the ... worthless if you're using a Windows version of the program. ... What key can I use in Excel that will shift the contents of a cell to ...
    (microsoft.public.mac.office.excel)
  • FUNCTION GETPIVOTDATA EXCEL FOR WINDOWS VS. EXCEL FOR MAC 2004
    ... I created a spreadsheet in microsoft excel 2003 for windows and used the ... 2004 for MAC) and the getpivotdata function didn't work. ... Pivot_table is a reference to any cell, range of cells, or named range of ... PivotTable report contains the data you want to retrieve. ...
    (microsoft.public.excel)
  • Function GETPIVOTDATA Excel 2003 for Windows vs Excel 2004 for MAC
    ... I created a spreadsheet in microsoft excel 2003 for windows and used the ... 2004 for MAC) and the getpivotdata function didn't work. ... Pivot_table is a reference to any cell, range of cells, or named range of ... PivotTable report contains the data you want to retrieve. ...
    (microsoft.public.mac.office.excel)