Mercurial > hg > octave-nkf
annotate scripts/java/org/octave/JDialogBox.java @ 17874:28e9562d708b
Fix display of '{}' for empty cells in GUI Variable window.
* libinterp/octave-value/ov-cell.cc(short_disp): Use parentheses around tertiary
operator expression so that C++ stream operator '<<' doesn't grab result of
test, rather than output of test.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 07 Nov 2013 09:54:38 -0800 |
parents | d63878346099 |
children | 56209bab4213 |
rev | line source |
---|---|
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
1 /* |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
2 |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
15753
diff
changeset
|
3 Copyright (C) 2010, 2013 Martin Hepperle |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
4 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
5 This file is part of Octave. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
6 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or (at |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
10 your option) any later version. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
11 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
15 General Public License for more details. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
16 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
20 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
21 */ |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 package org.octave; |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 import java.net.*; |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 import java.util.*; |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 import java.awt.*; |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 import javax.swing.*; |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 /** |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 * <p>Implementation of various dialog box functions</p> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 * |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 * <p>The following functions are provided for being called via |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 * Octave script files:</p> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 * <ul> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 * <li>errordlg</li> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 * <li>helpdlg</li> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 * <li>inputdlg</li> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 * </ul> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 * |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 * <p>Copyright (c) 2010 Martin Hepperle</p> |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 * |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 * @author Martin Hepperle |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 * @version 1.0 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 */ |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 public class JDialogBox |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
49 public static final int CLOSE_OK = 1; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
50 public static final int CLOSE_NO = 2; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
51 public static final int CLOSE_CANCEL = 3; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
53 // dialog type |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
54 public static int FLAG_LABEL = 1; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
55 public static int FLAG_TEXT = 2; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
56 public static int FLAG_INPUT = 4; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
57 public static int FLAG_LIST = 8; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
58 // icon selection |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
59 public static int FLAG_QUESTION = 32; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
60 public static int FLAG_ERROR = 64; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
61 public static int FLAG_WARNING = 128; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
62 public static int FLAG_INFORMATION = 256; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
64 public static int DLG_QUEST = FLAG_QUESTION | FLAG_TEXT; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
65 public static int DLG_INPUT = FLAG_QUESTION | FLAG_INPUT; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
66 public static int DLG_LIST = FLAG_QUESTION | FLAG_LIST; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
68 private final static String m_OK = "OK"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
69 private final static String m_Yes = "Yes"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
70 private final static String m_No = "No"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
71 private final static String m_Cancel = "Cancel"; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
73 private JButton m_ButtonNO; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
74 private JButton m_ButtonOK; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
75 private JButton m_ButtonCANCEL; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
76 private JButton m_Focus; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
77 private JTextArea m_TextField[]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
78 private JList m_List; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
79 private JFrame m_ParentFrame; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
80 private int m_CloseMethod; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
82 // ------------------------------------ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
83 // implementation of listdlg function |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
84 // ------------------------------------ |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
86 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
87 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
88 * @param listcell String[] - a array of strings, one for each list entry |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
89 * @param selmode String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
90 * @param sizecell Object[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
91 * @param initialcell Object[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
92 * @param name String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
93 * @param promptcell String[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
94 * @param okstring String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
95 * @param cancelstring String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
96 * @return String[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
97 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
98 public static int[] listdlg (String[] listcell, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
99 String selmode, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
100 Object[] sizecell, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
101 Object[] initialcell, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
102 String name, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
103 String[] promptcell, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
104 String okstring, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
105 String cancelstring) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
106 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
107 JDialogBox d = new JDialogBox (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
108 d.genericdlg (promptcell, listcell, name, selmode, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
109 DLG_LIST, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
110 sizecell, initialcell, okstring, null, cancelstring); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
111 return (d.getSelectedIndices ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
112 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
113 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
115 // ------------------------------------ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
116 // implementation of inputdlg function |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
117 // ------------------------------------- |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
118 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
119 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
120 * Implements a variation of the inputdlg function. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
121 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
122 * @param prompt String[] - an array of text strings to be used as labels. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
123 * @param title String - a text string to be used to label the dialog caption. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
124 * @param RowsCols int - defines the width of the text fields in columns. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
125 * @param defaults Object[] - an array of text strings or numbers to be |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
126 * placed into the text fields as default values. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
127 * @return String[] - an array of text strings containing the content of the |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
128 * text fields. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
129 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
130 public static String[] inputdlg (String[] prompt, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
131 String title, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
132 Object[] RowsCols, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
133 Object[] defaults) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
134 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
135 JDialogBox d = new JDialogBox (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
136 d.genericdlg (prompt, null, title, "on", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
137 FLAG_INPUT | FLAG_QUESTION, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
138 RowsCols, defaults, m_OK, null, m_Cancel); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
139 return (d.getInput ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
140 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
141 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
142 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
143 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
144 * Extract the current content from the text fields of an inputdlg. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
145 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
146 * @return String[] - the text contained in the fields of an inputdlg. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
147 * null if the dialog was cancelled. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
148 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
149 private String[] getInput () |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
150 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
151 String s[] = null; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
152 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
153 if (m_CloseMethod == CLOSE_OK) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
154 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
155 s = new String[m_TextField.length]; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
157 for (int i = 0; i < s.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
158 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
159 s[i] = new String (m_TextField[i].getText ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
160 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
162 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
163 return (s); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
164 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
166 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
167 private String getResult () |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
168 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
169 String s = null; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
170 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
171 if (m_CloseMethod == CLOSE_OK) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
172 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
173 s = m_ButtonOK.getText (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
174 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
175 else if (m_CloseMethod == CLOSE_CANCEL) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
176 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
177 s = m_ButtonCANCEL.getText (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
178 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
179 else |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
180 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
181 s = m_ButtonNO.getText (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
182 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
183 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
184 return (s); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
185 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
186 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
187 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
188 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
189 * Extract the current content from the text fields of an inputdlg. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
190 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
191 * @return String[] - the text contained in the fields of an inputdlg. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
192 * null if the dialog was cancelled. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
193 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
194 private String[] getSelection () |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
195 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
196 String s[] = null; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
197 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
198 if (m_CloseMethod == CLOSE_OK) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
199 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
200 int selection[] = m_List.getSelectedIndices (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
201 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
202 s = new String[selection.length]; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
203 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
204 for (int i = 0; i < s.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
205 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
206 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
207 // s[i] = new String (Integer.toString(selection[i])); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
208 s[i] = (m_List.getSelectedValues ()[i]).toString (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
209 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
210 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
211 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
212 return (s); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
213 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
214 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
215 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
216 private int[] getSelectedIndices () |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
217 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
218 int s[] = null; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
219 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
220 if (m_CloseMethod == CLOSE_OK) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
221 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
222 s = m_List.getSelectedIndices (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
223 for (int i = 0; i < s.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
224 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
225 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
226 // translate to 1 based indices |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
227 s[i] = s[i] + 1; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
228 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
229 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
230 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
231 return (s); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
232 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
233 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
234 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
235 public void SelectAll () |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
236 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
237 if (null != m_List) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
238 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
239 m_List.setSelectionInterval (0, m_List.getModel ().getSize () - 1); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
240 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
241 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
242 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
243 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
244 // ------------------------------------- |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
245 // implementation of helpdlg function |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
246 // ------------------------------------- |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
247 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
248 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
249 * Implements a simple helpdlg with default text and caption. Not very useful. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
250 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
251 * Octave > helpdlg('helpstring','title') |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
252 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
253 * Called via helpdlg.m. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
254 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
255 * @param helpstring String - a message string to be presented to the user. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
256 * The string can have embedded newline (\n) characters to break the message |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
257 * into multiple lines. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
258 * @param title String - a text string to be used to label the dialog caption. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
259 * @return int - always 1 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
260 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
261 public static int helpdlg (String helpstring, String title) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
262 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
263 JDialogBox d = new JDialogBox (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
264 String s[] = new String[1]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
265 s[0] = helpstring; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
266 return (d.genericdlg (s, null, title, "on", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
267 FLAG_TEXT | FLAG_INFORMATION, null, null, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
268 m_OK, null, m_Cancel)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
269 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
271 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
272 // ------------------------------------- |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
273 // implementation of emptydlg function |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
274 // ------------------------------------- |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
275 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
276 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
277 * Implements a simple helpdlg with default text and caption. Not very useful. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
278 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
279 * Octave > emptydlg('messagestring','title') |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
280 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
281 * Called via dlgbox.m. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
282 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
283 * @param messagestring String - a message string to be presented to the user. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
284 * The string can have embedded newline (\n) characters to break the message |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
285 * into multiple lines. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
286 * @param title String - a text string to be used to label the dialog caption. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
287 * @return int - always 1 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
288 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
289 public static int emptydlg (String helpstring, String title) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
290 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
291 JDialogBox d = new JDialogBox (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
292 String s[] = new String[1]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
293 s[0] = helpstring; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
294 return (d.genericdlg (s, null, title, "on", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
295 FLAG_TEXT, null, null, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
296 m_OK, null, m_Cancel)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
297 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
298 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
299 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
300 // ------------------------------------------- |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
301 // implementation of questdlg related functions |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
302 // ------------------------------------------- |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
303 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
304 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
305 * Implements a simple questdlg with default text and caption. Not very useful. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
306 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
307 * @param question String - the question to be presented |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
308 * @param title String - the caption |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
309 * @param options String[] - 'str1', 'str2', 'str3', 'default' |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
310 * @return String - the caption of the button pressed by the user |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
311 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
312 public static String questdlg (String question, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
313 String title, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
314 String[] options) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
315 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
316 JDialogBox d = new JDialogBox (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
317 String s[] = new String[1]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
318 s[0] = question; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
319 d.genericdlg (s, options, title, "on", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
320 DLG_QUEST, null, null, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
321 options[0], options[1], options[2]); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
322 return (d.getResult ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
323 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
324 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
325 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
326 // ------------------------------------- |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
327 // implementation of errordlg function |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
328 // ------------------------------------- |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
329 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
330 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
331 * Implements a simple errordlg with default text and caption. Not very useful. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
332 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
333 * @param errorstring String - the error message to display. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
334 * @param dlgname String - the caption of the dialog box. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
335 * @return int - always 1 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
336 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
337 public static int errordlg (String errorstring, String dlgname) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
338 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
339 JDialogBox d = new JDialogBox (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
340 String s[] = new String[1]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
341 s[0] = errorstring; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
342 return (d.genericdlg (s, null, dlgname, "on", FLAG_TEXT | FLAG_ERROR, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
343 null, null, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
344 m_OK, null, m_Cancel)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
345 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
346 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
347 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
348 // ------------------------------------------- |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
349 // implementation of warndlg related functions |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
350 // ------------------------------------------- |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
351 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
352 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
353 * Implements a simple warndlg with default text and caption. Not very useful. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
354 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
355 * Called via warndlg.m. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
356 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
357 * @param errorstring String - the message to be presented to the user. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
358 * @param dlgname String - the caption of the dialog box. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
359 * @return int - always 1 |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
360 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
361 public static int warndlg (String errorstring, String dlgname) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
362 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
363 JDialogBox d = new JDialogBox (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
364 String s[] = new String[1]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
365 s[0] = errorstring; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
366 return (d.genericdlg (s, null, dlgname, "on", FLAG_TEXT | FLAG_WARNING, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
367 null, null, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
368 m_OK, null, m_Cancel)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
369 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
370 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
371 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
372 // ------------------------------------- |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
373 // generic dlg function |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
374 // ------------------------------------- |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
375 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
376 * A generic dialog creation and display function. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
377 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
378 * @param message String[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
379 * @param list String[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
380 * @param caption String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
381 * @param on String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
382 * @param flag int |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
383 * @param RowsCols Object[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
384 * @param defaults Object[] |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
385 * @param okstring String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
386 * @param nostring String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
387 * @param cancelstring String |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
388 * @return int |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
389 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
390 public int genericdlg (String message[], |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
391 String list[], |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
392 String caption, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
393 String on, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
394 int flag, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
395 Object[] RowsCols, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
396 Object[] defaults, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
397 String okstring, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
398 String nostring, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
399 String cancelstring) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
400 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
401 TeXtranslator theTranslator = new TeXtranslator (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
402 setSystemLnF (true); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
403 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
404 caption = theTranslator.replace (caption); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
405 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
406 m_ButtonNO = null; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
407 m_ButtonOK = null; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
408 m_ButtonCANCEL = null; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
409 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
410 // create a modal dialog with an empty frame as its parent |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
411 m_ParentFrame = new JFrame (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
412 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
413 // --- trick to bring dialog to the front |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
414 // In Windows, the dialog is not brought to the foreground, but hidden |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
415 // behind the Octave window as long as the parent frame is not visible. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
416 // To avoid that the frame is visible, we move it outside of the screen. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
417 m_ParentFrame.setBounds (Toolkit.getDefaultToolkit ().getScreenSize (). |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
418 width + 100, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
419 Toolkit.getDefaultToolkit ().getScreenSize (). |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
420 height + 100, 1, 1); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
421 m_ParentFrame.setVisible (true); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
422 //-- end of trick |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
423 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
424 JDialog dlg; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
425 dlg = new JDialog (m_ParentFrame); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
426 dlg.setTitle (caption); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
427 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
428 dlg.setModal (true); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
429 dlg.setDefaultCloseOperation (JDialog.DISPOSE_ON_CLOSE); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
430 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
431 DlgListener theListener = new DlgListener (this); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
432 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
433 Container d = dlg.getContentPane (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
434 d.setLayout (new BorderLayout (8, 8)); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
435 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
436 // spacer |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
437 d.add (new JLabel (" "), BorderLayout.NORTH); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
438 d.add (new JLabel (" "), BorderLayout.EAST); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
439 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
440 JPanel p = new JPanel (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
441 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
442 if (FLAG_LABEL == (FLAG_LABEL & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
443 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
444 // a single line label |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
445 JLabel l = new JLabel (theTranslator.replace (message[0])); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
446 p.add (l); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
447 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
448 else if (FLAG_TEXT == (FLAG_TEXT & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
449 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
450 String msg = theTranslator.replace (message[0]); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
451 // a multi-line text display for helpdlg |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
452 StringTokenizer st = new StringTokenizer (msg, "\n"); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
453 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
454 int nRows = (null == RowsCols) ? 1 : |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
455 Integer.parseInt (RowsCols[0].toString ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
456 nRows = Math.max (nRows, st.countTokens ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
457 int nCols = Math.max (1, msg.length () / nRows); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
458 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
459 p.setLayout (new GridLayout (message.length, 1)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
460 JTextArea ta = new JTextArea (msg, nRows, nCols); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
461 ta.setEditable (false); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
462 ta.setFocusable (false); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
463 ta.setOpaque (false); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
464 // replace ugly monospaced font |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
465 ta.setFont (p.getFont ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
466 p.add (ta); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
467 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
468 else if (FLAG_INPUT == (FLAG_INPUT & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
469 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
470 // a multi label/textfield entry dialog for inputdlg |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
471 GridBagConstraints gbc = new GridBagConstraints (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
472 gbc.insets.top = 4; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
473 gbc.insets.left = 8; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
474 gbc.gridx = 0; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
475 gbc.anchor = GridBagConstraints.NORTHWEST; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
476 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
477 p.setLayout (new GridBagLayout ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
478 m_TextField = new JTextArea[message.length]; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
479 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
480 // default values |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
481 int nRows = 1; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
482 int nCols = 10; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
483 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
484 for (int i = 0; i < message.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
485 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
486 String msg = theTranslator.replace (message[i]); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
487 JLabel l = new JLabel (msg); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
488 l.setHorizontalAlignment (Label.LEFT); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
489 gbc.gridy = 2 * i; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
490 p.add (l, gbc); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
491 /** |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
492 * @todo CHECK handling of RowsCols for inputdlg |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
493 */ |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
494 if (RowsCols != null) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
495 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
496 if (RowsCols.length == 2 * message.length) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
497 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
498 nRows = Integer.parseInt (RowsCols[i].toString ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
499 nCols = Integer.parseInt (RowsCols[RowsCols.length / 2 + |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
500 i].toString ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
501 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
502 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
503 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
504 m_TextField[i] = new JTextArea ("", Math.max (nRows, 1), nCols); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
505 // avoid resizing |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
506 m_TextField[i].setPreferredSize (new Dimension (Math.max (nRows, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
507 1), nCols)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
508 m_TextField[i].setAutoscrolls (false); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
509 m_TextField[i].setFont (p.getFont ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
510 m_TextField[i].setBorder (new javax.swing.border.EtchedBorder ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
511 m_TextField[i].addKeyListener (theListener); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
512 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
513 gbc.gridy = 2 * i + 1; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
514 p.add (m_TextField[i], gbc); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
515 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
516 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
517 if (defaults != null) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
518 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
519 if (defaults.length == message.length) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
520 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
521 for (int i = 0; i < message.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
522 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
523 String def = theTranslator.replace (defaults[i].toString ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
524 m_TextField[i].setText (def); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
525 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
526 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
527 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
528 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
529 else if (DLG_LIST == (DLG_LIST & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
530 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
531 GridBagConstraints gbc = new GridBagConstraints (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
532 gbc.insets.top = 4; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
533 gbc.insets.left = 8; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
534 gbc.gridx = 0; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
535 gbc.anchor = GridBagConstraints.NORTHWEST; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
536 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
537 p.setLayout (new GridBagLayout ()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
538 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
539 for (int i = 0; i < message.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
540 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
541 // a single line label |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
542 String msg = theTranslator.replace (message[i]); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
543 JLabel l = new JLabel (msg); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
544 gbc.gridy = i; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
545 p.add (l, gbc); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
546 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
547 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
548 String lst[] = new String[list.length]; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
549 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
550 for (int i = 0; i < list.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
551 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
552 lst[i] = theTranslator.replace (list[i]); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
553 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
554 m_List = new JList (lst); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
555 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
556 // replace ugly monospaced font |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
557 m_List.setFont (p.getFont ()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
558 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
559 m_List.setMinimumSize (new Dimension (Math.max (1, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
560 Integer.parseInt (RowsCols[0].toString ())), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
561 Math.max (1, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
562 Integer.parseInt (RowsCols[1].toString ())))); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
563 m_List.setPreferredSize (new Dimension (Math.max (1, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
564 Integer.parseInt (RowsCols[1].toString ())), |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
565 Math.max (1, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
566 Integer.parseInt (RowsCols[0].toString ())))); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
567 m_List.setBorder (new javax.swing.border.EtchedBorder ()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
568 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
569 gbc.gridy = message.length; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
570 gbc.fill = GridBagConstraints.HORIZONTAL; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
571 p.add (m_List, gbc); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
572 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
573 if (on.toLowerCase ().equals ("single")) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
574 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
575 // single selection list |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
576 m_List.setSelectionMode (ListSelectionModel.SINGLE_SELECTION); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
577 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
578 m_List.setSelectedIndex (Integer.parseInt ( |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
579 defaults[0].toString ()) - 1); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
580 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
581 else |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
582 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
583 // multiple selection possible |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
584 m_List.setSelectionMode (ListSelectionModel. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
585 MULTIPLE_INTERVAL_SELECTION); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
586 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
587 int selection[] = new int[defaults.length]; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
588 for (int i = 0; i < defaults.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
589 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
590 selection[i] = Integer.parseInt (defaults[i].toString ()) - 1; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
591 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
592 m_List.setSelectedIndices (selection); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
593 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
594 JButton b = new JButton ("Select All"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
595 b.setActionCommand ("SELALL"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
596 b.addActionListener (theListener); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
597 gbc.gridy = message.length + 1; |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
598 gbc.fill = GridBagConstraints.HORIZONTAL; |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
599 p.add (b, gbc); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
600 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
601 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
602 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
603 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
604 // prepare icon, if any |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
605 String sIconFile = null; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
606 String sIconResource = null; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
607 Icon theIcon = null; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
608 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
609 if (FLAG_ERROR == (FLAG_ERROR & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
610 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
611 sIconFile = "images/error.png"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
612 // Java for Windows |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
613 sIconResource = "OptionPane.errorIcon"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
614 // Java for Linux does not offer these standard icons... |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
615 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
616 else if (FLAG_WARNING == (FLAG_WARNING & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
617 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
618 sIconFile = "images/warning.png"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
619 // Java for Windows |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
620 sIconResource = "OptionPane.warningIcon"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
621 // Java for Linux does not offer these standard icons... |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
622 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
623 else if (FLAG_QUESTION == (FLAG_QUESTION & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
624 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
625 sIconFile = "images/question.png"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
626 // Java for Windows |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
627 sIconResource = "OptionPane.questionIcon"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
628 // Java for Linux does not offer these standard icons... |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
629 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
630 else if (FLAG_INFORMATION == (FLAG_INFORMATION & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
631 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
632 sIconFile = "images/information.png"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
633 // Java for Windows |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
634 sIconResource = "OptionPane.informationIcon"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
635 // Java for Linux does not offer these standard icons... |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
636 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
637 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
638 // first try to find the UIManager specific icon to fit look and feel |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
639 // Note: the Windows XP look and feel offers 50 icons. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
640 if (sIconResource != null) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
641 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
642 UIDefaults df = UIManager.getLookAndFeelDefaults (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
643 theIcon = df.getIcon (sIconResource); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
644 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
645 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
646 // fallback on bitmap image resource if icon was not found |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
647 if (theIcon == null && |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
648 sIconFile != null) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
649 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
650 URL theResource = JDialogBox.class.getResource (sIconFile); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
651 if (theResource != null) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
652 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
653 theIcon = new ImageIcon (theResource); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
654 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
655 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
656 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
657 if (theIcon != null) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
658 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
659 // dummy panel to provide space around icon |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
660 JPanel pi = new JPanel (new GridLayout (1, 3)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
661 pi.add (new JLabel ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
662 pi.add (new JLabel (theIcon)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
663 pi.add (new JLabel ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
664 d.add (pi, BorderLayout.WEST); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
665 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
666 // use Octave icon if available. otherwise use dialog icon |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
667 Icon theOctaveIcon = getOctaveIcon (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
668 prepareFrameIcon (m_ParentFrame, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
669 theOctaveIcon == null ? theIcon : theOctaveIcon); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
670 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
671 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
672 d.add (p, BorderLayout.CENTER); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
673 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
674 // button bar (2 rows of 3 columns each |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
675 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
676 p = new JPanel (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
677 p.setLayout (new java.awt.GridLayout (2, 3)); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
678 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
679 // spacer row |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
680 p.add (new JLabel ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
681 p.add (new JLabel ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
682 p.add (new JLabel ()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
683 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
684 if (DLG_QUEST == (DLG_QUEST & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
685 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
686 // questdlg with empty option[2]: only two buttons |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
687 if (nostring.length () < 1) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
688 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
689 // spacer: left |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
690 p.add (new JLabel ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
691 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
692 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
693 else |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
694 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
695 // spacer: left |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
696 p.add (new JLabel ()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
697 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
698 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
699 m_ButtonOK = new JButton (theTranslator.replace (okstring)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
700 m_ButtonOK.setActionCommand ("OK"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
701 m_ButtonOK.addActionListener (theListener); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
702 m_Focus = m_ButtonOK; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
703 p.add (m_ButtonOK); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
704 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
705 if (DLG_QUEST == (DLG_QUEST & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
706 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
707 // questdlg with empty option[2]: only two buttons |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
708 if (nostring.length () > 01) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
709 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
710 // questdlg has three buttons |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
711 m_ButtonNO = new JButton (theTranslator.replace (nostring)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
712 m_ButtonNO.setActionCommand ("NO"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
713 m_ButtonNO.addActionListener (theListener); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
714 p.add (m_ButtonNO); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
715 if (DLG_QUEST == (DLG_QUEST & flag)) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
716 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
717 // select default button |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
718 if (list[3].equals (nostring)) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
719 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
720 m_Focus = m_ButtonNO; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
721 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
722 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
723 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
724 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
725 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
726 if (DLG_INPUT == (DLG_INPUT & flag) || |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
727 DLG_LIST == (DLG_LIST & flag) || |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
728 DLG_QUEST == (DLG_QUEST & flag)) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
729 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
730 m_ButtonCANCEL = new JButton (theTranslator.replace (cancelstring)); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
731 m_ButtonCANCEL.setActionCommand ("CANCEL"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
732 m_ButtonCANCEL.addActionListener (theListener); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
733 p.add (m_ButtonCANCEL); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
734 if (DLG_QUEST == (DLG_QUEST & flag)) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
735 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
736 // select default button |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
737 if (list[3].equals (cancelstring)) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
738 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
739 m_Focus = m_ButtonCANCEL; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
740 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
741 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
742 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
743 else |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
744 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
745 // spacer: right |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
746 p.add (new JLabel ()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
747 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
748 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
749 d.add (p, BorderLayout.SOUTH); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
750 dlg.pack (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
751 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
752 dlg.addWindowListener (theListener); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
753 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
754 if (on.equals ("on")) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
755 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
756 m_ParentFrame.setAlwaysOnTop (true); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
757 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
758 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
759 // center dialog on screen |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
760 Dimension dlgSize = dlg.getSize (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
761 Dimension screenSize = Toolkit.getDefaultToolkit ().getScreenSize (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
762 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
763 dlg.setLocation ((screenSize.width - dlgSize.width) / 2, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
764 (screenSize.height - dlgSize.height) / 2); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
765 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
766 dlg.setVisible (true); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
767 dlg.requestFocus (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
768 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
769 m_ParentFrame.setVisible (false); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
770 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
771 return (1); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
772 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
773 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
774 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
775 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
776 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
777 * @return Icon - null if icon was not found |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
778 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
779 private Icon getOctaveIcon () |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
780 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
781 Icon theIcon = null; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
782 URL theResource = JDialogBox.class.getResource ("images/octave.png"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
783 if (theResource != null) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
784 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
785 theIcon = new ImageIcon (theResource); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
786 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
787 return theIcon; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
788 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
789 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
790 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
791 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
792 * Replace the standard Java frame icon with an Octave Icon. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
793 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
794 * @param theFrame Frame - the Frame to decorate |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
795 * @param theIcon Icon - the icon to use if octave icon is not found. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
796 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
797 private void prepareFrameIcon (Frame theFrame, Icon theIcon) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
798 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
799 // prepare icon for upper left corner of Frame window |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
800 // maybe there is a simpler way to achieve this |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
801 int w = theIcon.getIconWidth (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
802 int h = theIcon.getIconHeight (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
803 // Frame must be made displayable by packing it for createImage() to succeed |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
804 theFrame.pack (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
805 Image theImage = theFrame.createImage (w, h); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
806 theIcon.paintIcon (theFrame, theImage.getGraphics (), 0, 0); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
807 theFrame.setIconImage (theImage); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
808 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
809 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
810 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
811 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
812 * Select Look and Feel |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
813 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
814 * @param bSystemLnF boolean - if true, the current systesm Look&Feel is used, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
815 * otherwise the Swing/Metal cross platform Look&Feel is used. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
816 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
817 private void setSystemLnF (boolean bSystemLnF) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
818 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
819 try |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
820 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
821 if (bSystemLnF) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
822 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
823 // switch from Swing LnF to local system LnF |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
824 UIManager.setLookAndFeel (UIManager. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
825 getSystemLookAndFeelClassName ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
826 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
827 else |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
828 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
829 // use Swing LnF |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
830 UIManager.setLookAndFeel (UIManager. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
831 getCrossPlatformLookAndFeelClassName ()); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
832 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
833 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
834 catch (Exception exception) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
835 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
836 exception.printStackTrace (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
837 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
838 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
839 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
840 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
841 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
842 * Called when the dialog is closed. Allows for specific cleanup actions. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
843 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
844 * @param closeMethod int - OctaveDialog.CLOSE_OK, OctaveDialog.CLOSE_CANCEL |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
845 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
846 public void closeDialog (int closeMethod) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
847 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
848 m_CloseMethod = closeMethod; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
849 m_ParentFrame.dispose (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
850 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
851 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
852 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
853 public void setFocus () |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
854 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
855 if (null != m_Focus) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
856 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
857 m_Focus.requestFocus (); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
858 m_ParentFrame.getRootPane ().setDefaultButton (m_Focus); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
859 m_ParentFrame.setAlwaysOnTop (true); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
860 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
861 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
862 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
863 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
864 /** |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
865 * Tests the dialogs |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
866 * |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
867 * @param args String[] - not used. |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
868 */ |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
869 public static void main (String[] args) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
870 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
871 TeXtranslator t = new TeXtranslator(); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
872 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
873 if (false) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
874 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
875 // find out key names of icon UI resources |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
876 UIDefaults df = UIManager.getLookAndFeelDefaults (); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
877 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
878 for (Enumeration e = df.keys (); e.hasMoreElements ();) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
879 { |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
880 String s = e.nextElement ().toString (); |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
881 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
882 if (s.toLowerCase ().contains ("icon")) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
883 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
884 System.out.println (s); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
885 } |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
886 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
887 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
888 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
889 try |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
890 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
891 Class[] argTypes = new Class[1]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
892 argTypes[0] = String.class; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
893 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
894 java.lang.reflect.Constructor c = ClassHelper.findConstructor (java.lang.StringBuffer.class, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
895 argTypes); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
896 Object argValues[] = new Object[1]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
897 argValues[0] = new String("initial value"); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
898 Object sb = c.newInstance(argValues); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
899 System.out.println(sb.toString()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
900 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
901 ClassHelper.invokeMethod(sb,"append",argValues,argTypes); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
902 System.out.println(sb.toString()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
903 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
904 argValues = new Object[2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
905 argTypes = new Class[2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
906 argTypes[0] = Integer.class; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
907 argTypes[1] = String.class; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
908 argValues[0] = new Integer(0); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
909 argValues[1] = new String("inserted"); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
910 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
911 ClassHelper.invokeMethod(sb,"insert",argValues,argTypes); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
912 System.out.println(sb.toString()); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
913 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
914 catch (Throwable e) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
915 {} |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
916 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
917 if (true) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
918 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
919 return; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
920 } |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
921 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
922 helpdlg ("If you need help\nyou should ask for help\nif someone is around\notherwise you are on your own.", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
923 "Information"); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
924 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
925 String[] options = new String[4]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
926 options[0] = "Yeah \\vartheta is too low"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
927 options[1] = "Maybe"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
928 options[2] = "Nay \\vartheta is too high"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
929 options[3] = "Maybe"; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
930 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
931 System.out.println (questdlg ("Is it too cold?", "Temperature", options)); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
932 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
933 // test variants of errordlg |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
934 // does not affect layering of dialog |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
935 errordlg ("Background error!", "Error"); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
936 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
937 // test variants of helpdlg |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
938 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
939 // test variants of inputdlg |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
940 String prompt[] = new String[2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
941 prompt[0] = "Question 1"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
942 prompt[1] = "Question 2"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
943 String defaults[] = new String[2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
944 defaults[0] = "1.1"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
945 defaults[1] = "2.2"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
946 String title = "Enter values"; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
947 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
948 Integer rc[] = new Integer[2 * 2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
949 rc[0] = new Integer (1); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
950 rc[1] = new Integer (2); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
951 rc[2] = new Integer (10); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
952 rc[3] = new Integer (20); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
953 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
954 inputdlg (prompt, title, rc, defaults); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
955 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
956 String listcell[] = new String[4]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
957 listcell[0] = "a \\alpha"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
958 listcell[1] = "b \\beta"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
959 listcell[2] = "c \\gamma"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
960 listcell[3] = "d \\delta"; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
961 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
962 Integer size[] = new Integer[2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
963 size[0] = new Integer (80); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
964 size[1] = new Integer (100); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
965 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
966 Integer initial[] = new Integer[2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
967 initial[0] = new Integer (4); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
968 initial[1] = new Integer (2); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
969 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
970 String promptcell[] = new String[2]; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
971 promptcell[0] = "Select something"; |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
972 promptcell[1] = "(or even more than one thing)"; |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
973 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
974 int idx[] = listdlg (listcell, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
975 "Multiple", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
976 size, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
977 initial, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
978 "name", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
979 promptcell, |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
980 "okstring", |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
981 "cancelstring"); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
982 |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
983 if (idx != null) |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
984 { |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
985 for (int i = 0; i < idx.length; i++) |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
986 { |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
987 System.out.println (idx[i]); |
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
988 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
989 } |
15753
6e39fe7992d9
style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents:
15625
diff
changeset
|
990 } |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
991 } |