| | | | Browse by category |
Article ID: 2180
Last updated: 28 May, 2018
Question
Can I use Java and/or Swing objects in an IlvManager?
Answer
Yes, but you need to put them in an IlvComponentGraphic
object or IlvJComponentGraphic
object so they will be drawn in all IlvManagerView
. The IlvComponentGraphic
is designed for AWT components and the IlvJComponentGraphic
is designed for Swing components. For IlvComponentGraphic
, the AWT behavior will be active only in its main IlvManagerView
(given at construction time).
The following example shows how to put a JButton
within an IlvManager
.
import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.plaf.metal.MetalIconFactory.FolderIcon16; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import ilog.views.IlvRect; import ilog.views.IlvManager; import ilog.views.IlvManagerView; import ilog.views.swing.IlvJManagerViewPanel; import ilog.views.swing.IlvJComponentGraphic; import ilog.views.util.IlvProductUtil; public class SwingObjectTest extends JFrame { public SwingObjectTest () { super("SwingObjectTest"); IlvManager manager = new IlvManager(); IlvManagerView view = new IlvManagerView(manager); getContentPane().add(new IlvJManagerViewPanel(view)); // This icon might not be present in // all JVM implementations. FolderIcon16 icon = new FolderIcon16(); manager.addObject(new IlvJComponentGraphic( new IlvRect(10F, 10F, 140F, 50F), new JButton("JButton", icon)), true); addWindowListener(new WindowAdapter() { public void windowClosing (WindowEvent e) { System.exit(0); } }); setBounds(10, 10, 300, 200); setVisible(true); } public static void main (String[] args) { // Comment the following line if using JViews 8.6 or earlier IlvProductUtil.DeploymentLicenseRequired( IlvProductUtil.IBM_ILOG_JViews_Diagrammer_Deployment); new SwingObjectTest(); } } // End of the SwingObjectTest class
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 2180
Last updated: 28 May, 2018
Revision: 3
Views: 1149
Posted: 04 Feb, 2008 by
Dean J.
Updated: 28 May, 2018 by
Gargani A.
Also listed in
Others in this category
Powered by KBPublisher (Knowledge base software)