Java Forum / General / November 2007
Why are the contents of this table not being shown?
Ramon F Herrera - 10 Nov 2007 15:03 GMT The code below was entirely generated by a visual GUI builder (*). This is the way it looks like, in design mode:
http://patriot.net/~ramon/misc/InvisibleTable.png
My problem is that the cell contents are not being displayed at run time for some reason.
What I am trying to do is port this NetBeans-specific module to standard code and jar:
http://platform.netbeans.org/tutorials/nbm-open-office.html
TIA!,
-Ramon
(*) from Instantiations at http://www.windowbuilderpro.com/
-------------------
package swingexample;
import java.awt.ComponentOrientation; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.border.EtchedBorder; import javax.swing.table.AbstractTableModel;
public class SwingExample extends JFrame {
private JTextField textField; private JTable table;
class TableTableModel extends AbstractTableModel { public final String[] COLUMN_NAMES = new String[] {"JavaLobby Title", "Date", "Author", "Reply"}; public int getRowCount() { return 0; } public int getColumnCount() { return COLUMN_NAMES.length; } public String getColumnName(int columnIndex) { return COLUMN_NAMES[columnIndex]; } public Object getValueAt(int rowIndex, int columnIndex) { return null; } }
public static void main(String args[]) { try { SwingExample frame = new SwingExample(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
public SwingExample() { super(); getContentPane().setLayout(null); setTitle("Swing Example"); setBounds(100, 100, 623, 581); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(30, 23, 554, 215); getContentPane().add(scrollPane);
table = new JTable(); table.setCellEditor(null); table.setShowGrid(true); table.setCellSelectionEnabled(true); table.setModel(new TableTableModel()); // table.setValueAt("Hello world?", 2, 3) <-- line added by me. scrollPane.setViewportView(table);
final JPanel panel = new JPanel(); panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); panel.setName("name here"); panel.setLayout(null); panel.setBounds(26, 345, 563, 74); getContentPane().add(panel);
final JLabel executableLabel = new JLabel(); executableLabel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); executableLabel.setText("Executable:"); executableLabel.setBounds(32, 30, 77, 14); panel.add(executableLabel);
textField = new JTextField(); textField.setBounds(111, 27, 329, 20); panel.add(textField);
final JButton browseButton = new JButton(); browseButton.setText("Browse..."); browseButton.setBounds(458, 26, 95, 23); panel.add(browseButton);
final JRadioButton mostRepliedRadioButton = new JRadioButton(); mostRepliedRadioButton.setSelected(true); mostRepliedRadioButton.setText("Most Replied"); mostRepliedRadioButton.setBounds(169, 452, 113, 23); getContentPane().add(mostRepliedRadioButton);
final JRadioButton leastRepliedRadioButton = new JRadioButton(); leastRepliedRadioButton.setText("Least Replied"); leastRepliedRadioButton.setBounds(344, 452, 113, 23); getContentPane().add(leastRepliedRadioButton);
final JButton generateReportButton = new JButton(); generateReportButton.setText("Generate Report"); generateReportButton.setBounds(236, 494, 142, 30); getContentPane().add(generateReportButton); }
}
Lew - 10 Nov 2007 15:17 GMT > The code below was entirely generated by a visual GUI builder (*). > This is the way it looks like, in design mode: [quoted text clipped - 3 lines] > My problem is that the cell contents are not being displayed at run > time for some reason. I suspect it's the "return 0" in getRowCount() and the "return null" in getValueAt().
Also, you need to construct your SwingExample instance on the EDT.
And do not embed TAB characters in Usenet posts!
Class TableTableModel can be static.
> ------------------- > public int getRowCount() { [quoted text clipped - 8 lines] > SwingExample frame = new SwingExample(); > frame.setVisible(true); Oops.
> } catch (Exception e) { > e.printStackTrace(); > } > }
 Signature Lew
Ramon F Herrera - 10 Nov 2007 15:54 GMT > > The code below was entirely generated by a visual GUI builder (*). > > This is the way it looks like, in design mode: [quoted text clipped - 3 lines] > > My problem is that the cell contents are not being displayed at run > > time for some reason.
> I suspect it's the "return 0" in getRowCount() and the "return null" in > getValueAt(). You are right, Lew. I modified the two returns:
public int getRowCount() { return 10; }
public Object getValueAt(int rowIndex, int columnIndex) { return "null"; }
and now the app behaves better. I guess I am supposed to build the table contents inside the 'TableTableModel'? IOW:
contents[1, 2] = "Hello"; contents[1, 3] = "World"; [...] public Object getValueAt(int rowIndex, int columnIndex) { return contents[rowIndex, columnIndex]; }
Matisse provides a fully implemented mechanism to fill JTables in design mode. I am less impressed by the mechanism above, which seems to be the only option with WindowBuilder.
-Ramon
Lew - 10 Nov 2007 16:20 GMT >>> My problem is that the cell contents are not being displayed at run >>> time for some reason. Lew wrote:
>> I suspect it's the "return 0" in getRowCount() and the "return null" in >> getValueAt().
> You are right, Lew. I modified the two returns: > [quoted text clipped - 5 lines] > return "null"; > } I predict that your JTable will always think the table is ten rows long, and will show the string "null" at every cell.
Read <http://java.sun.com/docs/books/tutorial/uiswing/components/table.html> particularly <http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#data>
Among other things, if you want your table to be editable you will need a method public void setValueAt(Object value, int row, int col)
<http://java.sun.com/javase/6/docs/api/javax/swing/table/AbstractTableModel.html# setValueAt(java.lang.Object,%20int,%20int)>
 Signature Lew
Roedy Green - 11 Nov 2007 23:29 GMT On Sat, 10 Nov 2007 07:54:59 -0800, Ramon F Herrera <ramon@conexus.net> wrote, quoted or indirectly quoted someone who said :
>and now the app behaves better. I guess I am supposed to build the >table contents inside the 'TableTableModel'? IOW: > >contents[1, 2] = "Hello"; >contents[1, 3] = "World"; >[...] There has to be some of array, or ArrayList or Collection to hold the data that the DataModel can fetch whenever the GUI decides it that row is now onscreen. It is up to you to fetch it. How does it get into the table? That to is completely up to you. It might be put there with some methods of your own. You might read it from a file. You might create it with static init. You might fetch it as needed from an SQL database, caching part of it... How you hold the model is 100% up to you.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Roedy Green - 11 Nov 2007 23:30 GMT On Sat, 10 Nov 2007 07:54:59 -0800, Ramon F Herrera <ramon@conexus.net> wrote, quoted or indirectly quoted someone who said :
>public Object getValueAt(int rowIndex, int columnIndex) { > return "null"; >} It might help to get an overview of how JTable works before diving into all the minutiae. See http://mindprod.com/jgloss/jtable.html
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Ramon F Herrera - 10 Nov 2007 16:12 GMT > Also, you need to construct your SwingExample instance on the EDT. I don't understand. :-( Are you saying that I should switch (complement?) my WindowBuilder Pro to the Eiffel Development Tool?
The other comment I didn't understand was your "oops". What's wrong with:
frame.setVisible(true);
?
-Ramon
Lew - 10 Nov 2007 16:15 GMT >> Also, you need to construct your SwingExample instance on the EDT. > > I don't understand. :-( Are you saying that I should switch > (complement?) my WindowBuilder Pro to the Eiffel Development Tool? Event Dispatch Thread.
Swing is not thread safe, so all Swing methods must execute in its thread. Your calls to the Swing library occurred in the main thread of the Java program. This can lead to unexpected behavior.
> The other comment I didn't understand was your "oops". What's wrong > with: > > frame.setVisible(true); <http://java.sun.com/javase/6/docs/api/javax/swing/package-summary.html#package_d escription>
 Signature Lew
Andrew Thompson - 11 Nov 2007 00:03 GMT ..
>> frame.setVisible(true); > ><http://java.sun.com/javase/6/docs/api/javax/swing/package-summary.html#package_d escription> I sometimes wonder 'What could possess people to use methods deprecated in 1.2?'.
One source is the unmaintained Sun Java Tutorial codes that use it, and apparently another is the Java 6.0 package docs., from which this example is lifted.
<snippet> ... public static void main(final String[] args) { // Schedule a job for the event-dispatching thread: // creating and showing this application's GUI. SwingUtilities.invokeLater(new Runnable() { public void run() { new MyApp(args).show(); } }); } </snippet>
..Sheesh!
 Signature Andrew Thompson http://www.athompson.info/andrew/
Ramon F Herrera - 11 Nov 2007 01:40 GMT > . > [quoted text clipped - 10 lines] > > <snippet> Lew & Andrew:
Given the weaknesses of Swing, which in addition to being thread- unsafe has bugs that continuously crash the JRE in 1.6, should I avoid it altogether and concentrate on learning SWT (*)?
-Ramon
(*) JFaces included
Lew - 11 Nov 2007 01:55 GMT > Given the weaknesses of Swing, which in addition to being thread-unsafe As compared to what other graphics library?
All the GUI APIs are thread-unsafe AFAIK.
> has bugs that continuously crash the JRE in 1.6, What bugs are those?
> should I avoid it altogether and concentrate on learning SWT (*)? I'd stick with Swing.
> (*) JFaces included I'm not familiar with JFaces.
 Signature Lew
Andrew Thompson - 11 Nov 2007 02:46 GMT >> Given the weaknesses of Swing, which in addition to being thread-unsafe > >As compared to what other graphics library? > >All the GUI APIs are thread-unsafe AFAIK. AWT* is 'fine' that way - it is 'thread-safe' AFAIU.
Otherwise I agree with the gist of the trimmed text.
* But no, I would not recommend using AWT just because you need a handful of extra lines to ensure Swing works as expected. I imagine SWT is the same, though I have not bothered to check.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Andrew Thompson - 11 Nov 2007 02:47 GMT ...
>...I imagine SWT is the same, ..as Swing - thread-unsafe.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Ramon F Herrera - 11 Nov 2007 03:15 GMT > > Given the weaknesses of Swing, which in addition to being thread-unsafe > [quoted text clipped - 3 lines] > > > has bugs that continuously crash the JRE in 1.6,
> What bugs are those? The bug(s) appears in Java 6 + Swing + WinXP. The easiest way to trigger it is with the file chooser, but other controls (such as a "Next" button) can trigger it too.
See crash dump below.
-Ramon
----------- # # An unexpected error has been detected by Java Runtime Environment: # # EXCEPTION_FLT_STACK_CHECK (0xc0000092) at pc=0x00bfcea9, pid=2292, tid=2396 # # Java VM: Java HotSpot(TM) Client VM (1.6.0_02-b05 mixed mode) # Problematic frame: # v ~RuntimeStub::resolve_opt_virtual_call # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp #
--------------- T H R E A D ---------------
Current thread (0x04d70c00): JavaThread "Swing-Shell" daemon [_thread_in_Java, id=2396]
siginfo: ExceptionCode=0xc0000092, ExceptionInformation=0x00000000 0x0547f904
Registers: EAX=0x1c2d0520, EBX=0x1f94ed90, ECX=0x100898b8, EDX=0x103c0438 ESP=0x0547f898, EBP=0x0547f9a8, ESI=0x1f94ede0, EDI=0x100898ec EIP=0x00bfcea9, EFLAGS=0x00010212
Top of Stack: (sp=0x0547f898) 0x0547f898: ffff1372 ffff0000 ffffffff 00be0369 0x0547f8a8: 03e8001b 0547f970 ffff0023 03847800 0x0547f8b8: 1f922178 ed6c01e5 796003d3 eab00392 0x0547f8c8: 02e0ea98 6d99ca03 1f200778 00111c04 0x0547f8d8: 00010000 f9de6000 b504f333 d0003fff 0x0547f8e8: b666fb66 400187c3 fffff800 ffffffff 0x0547f8f8: 000043fe 00000000 00000000 7c90e57c 0x0547f908: 7c80a027 00000730 6d8881c5 0547fb7c
Instructions: (pc=0x00bfcea9) 0x00bfce99: 00 00 83 ec 6c dd 34 24 9b dd 24 24 dd 5c 24 6c 0x00bfcea9: dd 5c 24 74 dd 5c 24 7c dd 9c 24 84 00 00 00 dd
Stack: [0x05430000,0x05480000), sp=0x0547f898, free space=318k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) v ~RuntimeStub::resolve_opt_virtual_call J sun.awt.shell.Win32ShellFolder2$FolderDisposer$1.call()Ljava/lang/ Object; J java.util.concurrent.FutureTask$Sync.innerRun()V J java.util.concurrent.FutureTask.run()V J java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Ljava/lang/ Runnable;)V j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+28 j sun.awt.shell.Win32ShellFolder2$ComTaskExecutor$2.run()V+7 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread ) =>0x04d70c00 JavaThread "Swing-Shell" daemon [_thread_in_Java, id=2396] 0x04d35400 JavaThread "Image Fetcher 1" daemon [_thread_blocked, id=3788] 0x04d31c00 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=3792] 0x04b7bc00 JavaThread "Thread-8" daemon [_thread_blocked, id=604] 0x04d77800 JavaThread "Refreshing filesystem" [_thread_blocked, id=344] 0x04d72c00 JavaThread "FS Synchronizer" [_thread_blocked, id=3100] 0x04dec000 JavaThread "Smack Listener Processor" daemon [_thread_blocked, id=2884] 0x04dd0c00 JavaThread "Smack Packet Reader" daemon [_thread_in_native, id=2892] 0x04d3a000 JavaThread "Smack Packet Writer" daemon [_thread_blocked, id=2860] 0x04d9cc00 JavaThread "WebServer thread pool" [_thread_blocked, id=976] 0x0333c800 JavaThread "Change List Updater" [_thread_blocked, id=3120] 0x039ef800 JavaThread "You got mail" [_thread_blocked, id=3796] 0x03a94c00 JavaThread "UserActivityMonitor thread" [_thread_blocked, id=1232] 0x04b3f000 JavaThread "WebServer thread pool" [_thread_blocked, id=2516] 0x04b3e000 JavaThread "/192.168.1.100 IDEtalk Multicast Thread" [_thread_in_native, id=3172] 0x032dd800 JavaThread "User Monitor Thread" [_thread_blocked, id=4032] 0x04bc2c00 JavaThread "XML-RPC Weblistener" [_thread_in_native, id=3820] 0x032a4800 JavaThread "Network Message Dispatcher" [_thread_blocked, id=876] 0x03a42800 JavaThread "ApplicationImpl pooled thread" [_thread_blocked, id=2700] 0x038ddc00 JavaThread "You got mail" [_thread_blocked, id=3756] 0x03917000 JavaThread "TimerQueue" daemon [_thread_blocked, id=2684] 0x038f3800 JavaThread "ApplicationImpl pooled thread" [_thread_blocked, id=3196] 0x038fe400 JavaThread "JetConnect reader" [_thread_blocked, id=3936] 0x0388c400 JavaThread "Exe4JStartupThread" daemon [_thread_blocked, id=3616] 0x037a6800 JavaThread "ApplicationImpl pooled thread" [_thread_blocked, id=3484] 0x03738800 JavaThread "ApplicationImpl pooled thread" [_thread_blocked, id=3580] 0x037a4400 JavaThread "XML-RPC Weblistener" [_thread_in_native, id=2528] 0x0378ec00 JavaThread "StoreRefreshStatusThread" daemon [_thread_blocked, id=3584] 0x0378e800 JavaThread "WatchForChangesThread" [_thread_in_native, id=3548] 0x0378e000 JavaThread "File System Tracker" [_thread_blocked, id=3816] 0x0378a800 JavaThread "Progress Cancel Checker" [_thread_blocked, id=3960] 0x03847800 JavaThread "AWT-EventQueue-1" [_thread_blocked, id=440] 0x0382b400 JavaThread "timed reference disposer" [_thread_blocked, id=3544] 0x0335e000 JavaThread "Periodic tasks thread" [_thread_blocked, id=3624] 0x0335bc00 JavaThread "SocketListenerThread" [_thread_in_native, id=3728] 0x0335b400 JavaThread "SocketListenerThread" [_thread_in_native, id=2832] 0x03312000 JavaThread "MessageDeliveryThread" [_thread_blocked, id=2688] 0x032fb800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3608] 0x032fb000 JavaThread "AWT-Shutdown" [_thread_blocked, id=2896] 0x032f7c00 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2380] 0x03217400 JavaThread "Lock thread" [_thread_in_native, id=3804] 0x031a4c00 JavaThread "timed reference disposer" [_thread_blocked, id=3944] 0x02e73000 JavaThread "Exe4JStartupThread" daemon [_thread_blocked, id=2356] 0x02e1e400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=752] 0x02e19800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1428] 0x02e18400 JavaThread "Attach Listener" daemon [_thread_blocked, id=320] 0x02e17800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2456] 0x02e08000 JavaThread "Finalizer" daemon [_thread_blocked, id=2496] 0x02e03c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=2560] 0x003e7000 JavaThread "main" [_thread_blocked, id=4036]
Other Threads: 0x02e00800 VMThread [id=2492] 0x02e1fc00 WatcherThread [id=2592]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap def new generation total 3776K, used 885K [0x10010000, 0x10420000, 0x10ed0000) eden [error occurred during error reporting, step 190, id 0xc0000092]
Dynamic libraries: 0x00400000 - 0x00490000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\bin\idea.exe 0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c8f5000 C:\WINDOWS\system32\kernel32.dll 0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.DLL 0x77e70000 - 0x77f02000 C:\WINDOWS\system32\RPCRT4.dll 0x77fe0000 - 0x77ff1000 C:\WINDOWS\system32\Secur32.dll 0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll 0x7e410000 - 0x7e4a0000 C:\WINDOWS\system32\USER32.dll 0x77c10000 - 0x77c68000 C:\WINDOWS\system32\msvcrt.dll 0x7c9c0000 - 0x7d1d5000 C:\WINDOWS\system32\SHELL32.DLL 0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll 0x773d0000 - 0x774d3000 C:\WINDOWS\WinSxS \x86_Microsoft.Windows.Common- Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll 0x5d090000 - 0x5d12a000 C:\WINDOWS\system32\comctl32.dll 0x74720000 - 0x7476b000 C:\WINDOWS\system32\MSCTF.dll 0x10000000 - 0x1000f000 C:\WINDOWS\system32\FRXHDLL.DLL 0x6d870000 - 0x6dab9000 e:\progra~1\jetbra~1\intell~1.1\jre\jre\bin \client\jvm.dll 0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll 0x7c340000 - 0x7c396000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\bin\MSVCR71.dll 0x009b0000 - 0x009c0000 C:\WINDOWS\system32\ctagent.dll 0x605d0000 - 0x605d9000 C:\WINDOWS\system32\mslbui.dll 0x6d3c0000 - 0x6d3c8000 e:\progra~1\jetbra~1\intell~1.1\jre\jre\bin \hpi.dll 0x77120000 - 0x771ab000 C:\WINDOWS\system32\OLEAUT32.DLL 0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll 0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL 0x6d820000 - 0x6d82c000 e:\progra~1\jetbra~1\intell~1.1\jre\jre\bin \verify.dll 0x6d460000 - 0x6d47f000 e:\progra~1\jetbra~1\intell~1.1\jre\jre\bin \java.dll 0x6d860000 - 0x6d86f000 e:\progra~1\jetbra~1\intell~1.1\jre\jre\bin \zip.dll 0x6d620000 - 0x6d633000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\net.dll 0x71ab0000 - 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll 0x71aa0000 - 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll 0x71a50000 - 0x71a8f000 C:\WINDOWS\system32\mswsock.dll 0x662b0000 - 0x66308000 C:\WINDOWS\system32\hnetcfg.dll 0x71a90000 - 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll 0x6d0b0000 - 0x6d273000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\awt.dll 0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV 0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.dll 0x6d360000 - 0x6d3b3000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\fontmanager.dll 0x03590000 - 0x03599000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\bin\focuskiller.dll 0x76f20000 - 0x76f47000 C:\WINDOWS\system32\DNSAPI.dll 0x76fb0000 - 0x76fb8000 C:\WINDOWS\System32\winrnr.dll 0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll 0x03ac0000 - 0x03ad9000 C:\Program Files\Bonjour\mdnsNSP.dll 0x76d60000 - 0x76d79000 C:\WINDOWS\system32\Iphlpapi.dll 0x76fc0000 - 0x76fc6000 C:\WINDOWS\system32\rasadhlp.dll 0x76d40000 - 0x76d58000 C:\WINDOWS\system32\MPRAPI.dll 0x77cc0000 - 0x77cf2000 C:\WINDOWS\system32\ACTIVEDS.dll 0x76e10000 - 0x76e35000 C:\WINDOWS\system32\adsldpc.dll 0x5b860000 - 0x5b8b4000 C:\WINDOWS\system32\NETAPI32.dll 0x76b20000 - 0x76b31000 C:\WINDOWS\system32\ATL.DLL 0x76e80000 - 0x76e8e000 C:\WINDOWS\system32\rtutils.dll 0x71bf0000 - 0x71c03000 C:\WINDOWS\system32\SAMLIB.dll 0x77920000 - 0x77a13000 C:\WINDOWS\system32\SETUPAPI.dll 0x6d640000 - 0x6d649000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\nio.dll 0x6d490000 - 0x6d496000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\jawt.dll 0x008b0000 - 0x008d7000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\bin\FileWatcher2K.dll 0x71b20000 - 0x71b32000 C:\WINDOWS\system32\MPR.dll 0x77b40000 - 0x77b62000 C:\WINDOWS\system32\Apphelp.dll 0x6d2a0000 - 0x6d2cf000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\cmm.dll 0x6d500000 - 0x6d524000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\jpeg.dll 0x6d2d0000 - 0x6d2f3000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\dcpr.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x769c0000 - 0x76a73000 C:\WINDOWS\system32\USERENV.dll 0x6d800000 - 0x6d808000 E:\Program Files\JetBrains\IntelliJ IDEA 7.0.1\jre\jre\bin\sunmscapi.dll 0x77a80000 - 0x77b14000 C:\WINDOWS\system32\CRYPT32.dll 0x77b20000 - 0x77b32000 C:\WINDOWS\system32\MSASN1.dll 0x76fd0000 - 0x7704f000 C:\WINDOWS\system32\CLBCATQ.DLL 0x77050000 - 0x77115000 C:\WINDOWS\system32\COMRes.dll 0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll 0x76980000 - 0x76988000 C:\WINDOWS\system32\LINKINFO.dll 0x76990000 - 0x769b5000 C:\WINDOWS\system32\ntshrui.dll 0x75f60000 - 0x75f67000 C:\WINDOWS\System32\drprov.dll 0x71c10000 - 0x71c1e000 C:\WINDOWS\System32\ntlanman.dll 0x71cd0000 - 0x71ce7000 C:\WINDOWS\System32\NETUI0.dll 0x71c90000 - 0x71cd0000 C:\WINDOWS\System32\NETUI1.dll 0x71c80000 - 0x71c87000 C:\WINDOWS\System32\NETRAP.dll 0x75f70000 - 0x75f79000 C:\WINDOWS\System32\davclnt.dll 0x05930000 - 0x05bae000 C:\WINDOWS\system32\wpdshext.dll 0x4ec50000 - 0x4edf3000 C:\WINDOWS\WinSxS \x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.2180_x- ww_522f9f82\gdiplus.dll 0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\UxTheme.dll 0x05d00000 - 0x05d49000 C:\WINDOWS\system32\PortableDeviceApi.dll 0x76c30000 - 0x76c5e000 C:\WINDOWS\system32\WINTRUST.dll 0x76c90000 - 0x76cb8000 C:\WINDOWS\system32\IMAGEHLP.dll 0x73d70000 - 0x73d83000 C:\WINDOWS\System32\shgina.dll 0x75970000 - 0x75a67000 C:\WINDOWS\system32\MSGINA.dll 0x76360000 - 0x76370000 C:\WINDOWS\system32\WINSTA.dll 0x74320000 - 0x7435d000 C:\WINDOWS\system32\ODBC32.dll 0x763b0000 - 0x763f9000 C:\WINDOWS\system32\comdlg32.dll 0x05900000 - 0x05917000 C:\WINDOWS\system32\odbcint.dll 0x07160000 - 0x071a6000 C:\WINDOWS\system32\Audiodev.dll 0x05f50000 - 0x061aa000 C:\WINDOWS\system32\WMVCore.DLL 0x061b0000 - 0x061e9000 C:\WINDOWS\system32\WMASF.DLL 0x593f0000 - 0x59482000 C:\WINDOWS\system32\wiashext.dll 0x771b0000 - 0x77256000 C:\WINDOWS\system32\WININET.dll 0x062b0000 - 0x06575000 C:\WINDOWS\system32\xpsp2res.dll 0x73ba0000 - 0x73bb3000 C:\WINDOWS\System32\sti.dll 0x74ae0000 - 0x74ae7000 C:\WINDOWS\System32\CFGMGR32.dll 0x62350000 - 0x623a3000 C:\Program Files\OpenOffice.org 2.3\program \shlxthdl.dll 0x60400000 - 0x60418000 C:\Program Files\OpenOffice.org 2.3\program \uwinapi.dll 0x61e70000 - 0x61efe000 C:\Program Files\OpenOffice.org 2.3\program \stlport_vc7145.dll 0x7c3a0000 - 0x7c41b000 C:\Program Files\OpenOffice.org 2.3\program \MSVCP71.dll 0x7d1e0000 - 0x7d49e000 C:\WINDOWS\system32\msi.dll 0x06620000 - 0x0667a000 C:\Program Files\RFSDispatcher \CustColHandler.dll 0x5edd0000 - 0x5ede7000 C:\WINDOWS\system32\OLEPRO32.DLL 0x06780000 - 0x067db000 C:\Program Files\Common Files\Adobe\Acrobat \ActiveX\PDFShell.dll 0x78130000 - 0x781cb000 C:\WINDOWS\WinSxS \x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.163_x-ww_681e29fb \MSVCR80.dll
VM Arguments: jvm_args: - Dexe4j.semaphoreName=e:_progra~1_jetbra~1_intell~1.1_bin_idea.exe - Dexe4j.moduleName=e:\progra~1\jetbra~1\intell~1.1\bin\idea.exe - Dexe4j.processCommFile=C:\DOCUME~1\ramon\LOCALS~1\Temp\e4j_p2292.tmp - Dexe4j.tempDir=C:\DOCUME~1\ramon\LOCALS~1\Temp\e4j4.tmp_dir29937 - Xms32m -Xmx192m -XX:MaxPermSize=120m -ea -Xbootclasspath/p:e: \progra~1\jetbra~1\intell~1.1\bin\/../lib/boot.jar - Didea.properties.file=${IDEA_PROPERTIES} java_command: <unknown> Launcher Type: generic
Environment Variables: PATH=C:\Documents and Settings\ramon\bin;C:\PROGRA~1\Borland \CBUILD~1\Bin;C:\PROGRA~1\Borland\CBUILD~1\Projects\Bpl;C:\CBuilderX \bin;C:\Program Files\Intel\MKL60\ia32\bin;C:\Program Files\Intel \EDB70;C:\Program Files\Intel\Compiler70\IA32\Bin;C:\Program Files \Common Files\Intel\Shared Files\Ia32\Bin;C:\WINDOWS\system32;C: \WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files \Adaptec Shared\System;C:\Program Files\Hummingbird\Connectivity \7.11\Accessories\;C:\Program Files\Pinnacle\Shared Files;C:\CBuilderX \PlatformSDK\bin\Win64;C:\Program Files;C:\ USERNAME=ramon OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 7, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 1 (1 cores per cpu, 2 threads per core) family 15 model 2 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, ht
Memory: 4k page, physical 1047556k(425676k free), swap 2524192k(2063264k free)
vm_info: Java HotSpot(TM) Client VM (1.6.0_02-b05) for windows-x86, built on Jun 14 2007 15:45:56 by "java_re" with unknown MS VC++:1310
Andrew Thompson - 11 Nov 2007 03:54 GMT >> > Given the weaknesses of Swing, which in addition to being thread-unsafe ...
>> > has bugs that continuously crash the JRE in 1.6, > [quoted text clipped - 5 lines] > >See crash dump below. (big snip)
O..K. 1) Have you got a (simple) source that causes that behaviour? 2) Is it attempting to do this from outside* the EDT? * A thread other than the EDT.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Ramon F Herrera - 11 Nov 2007 05:31 GMT > >> > Given the weaknesses of Swing, which in addition to being thread-unsafe > .. [quoted text clipped - 14 lines] > 2) Is it attempting to do this from outside* the EDT? > * A thread other than the EDT. Never mind, Andrew... They just fixed my bug!! Finally! I don't know if it was some two dozen bug reports that I submitted, or all the winning and bitching in this NG and others.
Bug ID: 6522704 http://bugs.sun.com/view_bug.do?bug_id=6522704
(at least that bug seems very much like mine).
The fix hasn't made it to the public JRE, but it is in the latest early release:
https://jdk6.dev.java.net/
-Ramon
zfkmk@yahoo.com - 11 Nov 2007 17:48 GMT > . > [quoted text clipped - 23 lines] > > .Sheesh! Is this a good or bad example? If bad, what is wrong with it?
Eugene
Andrew Thompson - 11 Nov 2007 19:10 GMT ...
>Is this a good or bad example? Bad.
> If bad, what is wrong with it? <sscce> import javax.swing.*;
class MyApp extends JFrame {
MyApp(String[] args) {}
public static void main(final String[] args) { // Schedule a job for the event-dispatching thread: // creating and showing this application's GUI. SwingUtilities.invokeLater(new Runnable() { public void run() { new MyApp(args).show(); } }); } } </sscce>
D:\>javac MyApp.java
Note: D:\MyApp.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.
D:\>javac -Xlint:deprecation MyApp.java MyApp.java:13: warning: [deprecation] show() in java.awt.Window has been deprecated new MyApp(args).show(); ^ 1 warning
Which, when we check the JDocs indicates.. Deprecated. As of JDK version 1.5, replaced by setVisible(boolean).
When I stated that though, I (again) mistook it for the Component.show() method deprecated in 1.1.
Either way, it is deprecated, and has been for the last two Java releases.
So - it is bad for showing deprecated code in the package docs of (a major part of) the official documentation for the language.
 Signature Andrew Thompson http://www.athompson.info/andrew/
zfkmk@yahoo.com - 11 Nov 2007 19:40 GMT > zf...@yahoo.com wrote: > [quoted text clipped - 10 lines] > > class MyApp extends JFrame { I even more confused now. Where does your sscce come from? I do not see any references to JFrame in the example on http://java.sun.com/javase/6/docs/api/javax/swing/package-summary.html#package_d escription
Eugene
Mark Space - 11 Nov 2007 20:51 GMT > I even more confused now. Where does your sscce come from? I do not > see any references to JFrame in the example on > http://java.sun.com/javase/6/docs/api/javax/swing/package-summary.html#package_d escription Here's cut and paste from that link: ----- public class MyApp implements Runnable { public void run() { // Invoked on the event dispatching thread. // Construct and show GUI. }
public static void main(String[] args) { SwingUtilities.invokeLater(new MyApp(args)); } } ----- See the comment where it says "GUI?" That means JFrame and friends. Try clicking on the link at the bottom of that page where it says "Swing Tutorial."
zfkmk@yahoo.com - 11 Nov 2007 21:51 GMT > zf...@yahoo.com wrote: > > I even more confused now. Where does your sscce come from? I do not [quoted text clipped - 17 lines] > clicking on the link at the bottom of that page where it says "Swing > Tutorial." I do know what JFrame is. I did click on that link and everything there looked just fine to me, including the examples. That is why I asked Andrew what was wrong with the example. Andrew then replied with a completely different example, in which MyApp extends JFrame. The example on the Java docs page MyApp does not extend anything. (Well, extends Object, but Object does not have show().)
Eugene
Daniel Pitts - 11 Nov 2007 22:12 GMT >> zf...@yahoo.com wrote: >>> I even more confused now. Where does your sscce come from? I do not [quoted text clipped - 25 lines] > > Eugene To his defense, the original post only showed the call to new MyApp().show(), which looks like it belongs to a JFrame object. In a GUI context, thats not an unreasonable assumption. Thats why its always best to post a complete SSCCE, rather than only the snippet that you think is appropriate.
 Signature Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Andrew Thompson - 12 Nov 2007 06:31 GMT >>> zf...@yahoo.com wrote: >>>> I even more confused now. Where does your sscce come from? I do not ....
>To his defense, the original post only showed the call to >new MyApp().show(), which looks like it belongs to a JFrame object. That was pretty much my assumption. - The invokeLater() call is most commonly used for root components, - the most common root component used is a JFrame - (it was the Swing package, so we might rule out a java.awt.Frame).
The lines I added were literally (as far as I was trying) 'wrapped around' the given code, to show the actual effect when compiled.
Then, since is constituted an SSCCE, I labelled it as such.
>...Thats why its >always best to post a complete SSCCE, rather than only the snippet that >you think is appropriate. Very sound advice. I try to take that principle myself. ;-)
 Signature Andrew Thompson http://www.athompson.info/andrew/
Daniel Pitts - 12 Nov 2007 17:03 GMT >> ...Thats why its >> always best to post a complete SSCCE, rather than only the snippet that >> you think is appropriate. > > Very sound advice. I try to take that principle myself. ;-) I think I paraphrased you actually :-)
 Signature Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Roedy Green - 12 Nov 2007 02:10 GMT On Sat, 10 Nov 2007 08:12:32 -0800, Ramon F Herrera <ramon@conexus.net> wrote, quoted or indirectly quoted someone who said :
>I don't understand. :-( Are you saying that I should switch >(complement?) my WindowBuilder Pro to the Eiffel Development Tool? No. See http://mindprod.com/jgloss/edt.html
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|