Thread: [Java-gnome-developer] JTable(Swing) to java-gnome
Brought to you by:
afcowie
From: Ralph H. <ra...@gm...> - 2005-03-22 08:45:51
|
Hi, i written a program that's use a swing.JTable, i will porting the program to java-gnome. I'm not found why can make a Jtable in java-gnome. What must i use. I hope you can help me. ---------- Swing JTabble....... public JTable getJTableSerien() { if (jTableSerien == null) { serienTableModel = new GuiSerienTableModel(control); serienTableSorter = new GuiTableSorter(serienTableModel); jTableSerien = new JTable(serienTableSorter); serienTableSorter.setTableHeader(jTableSerien.getTableHeader()); jTableSerien.addMouseListener(control); jTableSerien.setName("serienTable"); jTableSerien.setTableHeader(jTableSerien.getTableHeader()); jTableSerien.getColumnModel().getColumn(0).setMaxWidth(330); jTableSerien.getColumnModel().getColumn(1).setMaxWidth(45); jTableSerien.getColumnModel().getColumn(2).setMaxWidth(45); jTableSerien.getColumnModel().getColumn(3).setMaxWidth(270); jTableSerien.getColumnModel().getColumn(4).setMaxWidth(270); jTableSerien.getColumnModel().getColumn(3).setCellRenderer(new TableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column){ JTextPane p = new JTextPane(); if (isSelected) { p.setForeground(table.getSelectionForeground()); p.setBackground(table.getSelectionBackground()); } else{ p.setForeground(table.getForeground()); p.setBackground(table.getBackground()); } String val = ""; p.setMargin(new Insets(0, 0, 0, 0)); if (value == null) value = ""; val = value.toString(); p.setText(val); if(getSearch().length()>=1){ SerFormatter.highlight(p, getSearch()); }else{ SerFormatter.removeHighlights(p); } return p; } Greets Ralph ------------------------------- -- Ralph Henneberger <ra...@gm...> |
From: Andrew C. <an...@op...> - 2005-03-23 00:54:51
|
On Tue, 2005-22-03 at 09:45 +0100, Ralph Henneberger wrote: > i written a program that's use a swing.JTable, i will porting the > program to java-gnome. The GTK table widget is quite tricky to use; The underlying GTK TreeView/TreeModel API is considerably different from what swing provides, and the java-gnome binding is similarly different. You should first read: http://java-gnome.sourceforge.net/docs/javadoc-2.8.2/org/gnu/gtk/TreeView.html and the javadoc for other related classes. Then you might look at some examples code. In particular, in the java-gnome source code for the libgtk-java package, you will find doc/examples/tree/TreeExample.java which shows many of the basics. After you've looked at that, let us know if its making sense. AfC Sydney -- Andrew Frederick Cowie Management Consultant Technology strategy, managing change, establishing procedures, and executing successful upgrades to mission critical business infrastructure. http://www.operationaldynamics.com/ Sydney New York Toronto London |
From: pancake <pa...@ph...> - 2005-03-23 17:56:25
|
i'll nice to use jawt to attach awt/swing widgets inside java-gnome applications. How do you see that idea? On Wed, 23 Mar 2005 11:54:44 +1100 Andrew Cowie <an...@op...> wrote: > On Tue, 2005-22-03 at 09:45 +0100, Ralph Henneberger wrote: > > i written a program that's use a swing.JTable, i will porting the > > program to java-gnome. > > The GTK table widget is quite tricky to use; The underlying GTK > TreeView/TreeModel API is considerably different from what swing > provides, and the java-gnome binding is similarly different. > > You should first read: > > http://java-gnome.sourceforge.net/docs/javadoc-2.8.2/org/gnu/gtk/TreeView.html > > and the javadoc for other related classes. > > Then you might look at some examples code. In particular, in the > java-gnome source code for the libgtk-java package, you will find > > doc/examples/tree/TreeExample.java > > which shows many of the basics. After you've looked at that, let us know > if its making sense. > > AfC > Sydney > > -- > Andrew Frederick Cowie > Management Consultant > > Technology strategy, managing change, establishing procedures, > and executing successful upgrades to mission critical business > infrastructure. > > http://www.operationaldynamics.com/ > > Sydney New York Toronto London > > > > ------------------------------------------------------- > This SF.net email is sponsored by: 2005 Windows Mobile Application Contest > Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones > for the chance to win $25,000 and application distribution. Enter today at > http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: Ka-Hing C. <ka...@gm...> - 2005-03-24 00:10:25
|
On Wed, 23 Mar 2005 11:54:44 +1100, Andrew Cowie <an...@op...> wrote: > The GTK table widget is quite tricky to use; The underlying GTK > TreeView/TreeModel API is considerably different from what swing > provides, and the java-gnome binding is similarly different. There's currently no way to implement the model(without copying)/renderer with java-gnome, is there any plan to improve things in that area? -khc |