summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMajouane BENJELLOUL <majouane.benjelloul@inria.fr>2007-07-16 09:45:42 +0000
committerMajouane BENJELLOUL <majouane.benjelloul@inria.fr>2007-07-16 09:45:42 +0000
commite84693e2381526b73a965b57c196b4bc19daeb36 (patch)
treed5f8c9b6b328696a9a0d7a3ab9e453383bd07434 /tests
parent675fa66210e8f96f10afc8f06f575ac680128f30 (diff)
downloadscilab-e84693e2381526b73a965b57c196b4bc19daeb36.zip
scilab-e84693e2381526b73a965b57c196b4bc19daeb36.tar.gz
First Window Test with Bridge Interface
Diffstat (limited to 'tests')
-rw-r--r--tests/GUI/marouane/WindowTest1.java125
1 files changed, 125 insertions, 0 deletions
diff --git a/tests/GUI/marouane/WindowTest1.java b/tests/GUI/marouane/WindowTest1.java
new file mode 100644
index 0000000..cfe0c17
--- /dev/null
+++ b/tests/GUI/marouane/WindowTest1.java
@@ -0,0 +1,125 @@
1/* Copyright INRIA 2007 */
2
3package marouane;
4
5import java.awt.BorderLayout;
6import java.awt.Color;
7import java.awt.EventQueue;
8import java.awt.event.*;
9
10import javax.swing.JPanel;
11import javax.swing.UIManager;
12import javax.swing.border.LineBorder;
13
14import org.flexdock.util.SwingUtility;
15import org.flexdock.docking.DockingManager;
16import org.scilab.modules.gui.canvas.Canvas;
17import org.scilab.modules.gui.canvas.ScilabCanvas;
18import org.scilab.modules.gui.dockable.Dockable;
19import org.scilab.modules.gui.frame.Frame;
20import org.scilab.modules.gui.frame.ScilabFrame;
21import org.scilab.modules.gui.menuitem.MenuItem;
22import org.scilab.modules.gui.menu.Menu;
23import org.scilab.modules.gui.menubar.MenuBar;
24import org.scilab.modules.gui.menuitem.ScilabMenuItem;
25import org.scilab.modules.gui.menu.ScilabMenu;
26import org.scilab.modules.gui.menubar.ScilabMenuBar;
27import org.scilab.modules.gui.pushbutton.PushButton;
28import org.scilab.modules.gui.pushbutton.ScilabPushButton;
29import org.scilab.modules.gui.tab.ScilabTab;
30import org.scilab.modules.gui.tab.Tab;
31import org.scilab.modules.gui.toolbar.ScilabToolBar;
32import org.scilab.modules.gui.toolbar.ToolBar;
33import org.scilab.modules.gui.utils.Size;
34import org.scilab.modules.gui.window.ScilabWindow;
35import org.scilab.modules.gui.window.Window;
36
37/**
38 * Basic test
39 * @author Marouane BEN JELLOUL
40 */
41public class WindowTest1 {
42
43 /**
44 * Constructor
45 */
46 protected WindowTest1() {
47 throw new UnsupportedOperationException(); /* Prevents calls from subclass */
48 }
49
50 /**
51 * Launch main WindowTest1
52 * @param args not used
53 */
54 public static void main(String[] args) {
55 SwingUtility.setPlaf(UIManager.getSystemLookAndFeelClassName());
56
57 DockingManager.setFloatingEnabled(true);
58
59 EventQueue.invokeLater(new Runnable() {
60 public void run() {
61 createAndShowGui();
62 }
63 });
64 }
65
66 /**
67 * Creates and show WindowTest1
68 */
69 private static void createAndShowGui() {
70 System.out.println("-*- Starting Program WindowTest1 -*-");
71
72 Window mainView = ScilabWindow.createWindow();
73 mainView.setTitle("WindowTest1");
74
75 // menuBar
76 MenuBar menuBar = ScilabMenuBar.createMenuBar();
77
78 // menu File
79 Menu menu = ScilabMenu.createMenu();
80 menu.setText("File");
81 menu.setMnemonic(KeyEvent.VK_F);
82 MenuItem menuItem = ScilabMenuItem.createMenuItem();
83 menuItem.setText("New Scilab");
84 menuItem.setMnemonic(KeyEvent.VK_N);
85 menu.add(menuItem);
86 menu.addSeparator();
87 menuItem = ScilabMenuItem.createMenuItem();
88 menuItem.setText("Exec ...");
89 menuItem.setMnemonic(KeyEvent.VK_E);
90 menu.add(menuItem);
91 menuBar.add(menu);
92
93 // menu Edit
94 menu = ScilabMenu.createMenu();
95 menu.setText("Edit");
96 menu.setMnemonic(KeyEvent.VK_E);
97 menuItem = ScilabMenuItem.createMenuItem();
98 menuItem.setText("Select All");
99 menuItem.setMnemonic(KeyEvent.VK_S);
100 menu.add(menuItem);
101 menuBar.add(menu);
102
103 System.out.println("mainView.menuBar is null : result = " + mainView.getMenuBar());
104 mainView.setMenuBar(menuBar);
105 System.out.println("mainView.menuBar Added : result = " + mainView.getMenuBar());
106
107 // toolBar
108 ToolBar toolBar = ScilabToolBar.createToolBar();
109 PushButton pushButton = ScilabPushButton.createPushButton();
110 pushButton.setText("PB One");
111 toolBar.add(pushButton);
112 pushButton = ScilabPushButton.createPushButton();
113 pushButton.setText("PB Two");
114 toolBar.add(pushButton);
115
116 System.out.println("mainView.toolBar is null : result = " + mainView.getToolBar());
117 mainView.setToolBar(toolBar);
118 System.out.println("mainView.toolBar is null : result = " + mainView.getToolBar());
119
120 mainView.draw();
121
122 System.out.println("-*- Last Line Program WindowTest1 -*-");
123 }
124
125}