167 * Initialize print dialog.
168 */
169 void initPrintDialog(int x, int y,
170 PrintService[] services,
171 int defaultServiceIndex,
172 DocFlavor flavor,
173 PrintRequestAttributeSet attributes)
174 {
175 this.services = services;
176 this.defaultServiceIndex = defaultServiceIndex;
177 this.asOriginal = attributes;
178 this.asCurrent = new HashPrintRequestAttributeSet(attributes);
179 this.psCurrent = services[defaultServiceIndex];
180 this.docFlavor = flavor;
181 SunPageSelection pages =
182 (SunPageSelection)attributes.get(SunPageSelection.class);
183 if (pages != null) {
184 isAWT = true;
185 }
186
187 if (attributes.get(DialogOnTop.class) != null) {
188 setAlwaysOnTop(true);
189 }
190 Container c = getContentPane();
191 c.setLayout(new BorderLayout());
192
193 tpTabs = new JTabbedPane();
194 tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));
195
196 String gkey = getMsg("tab.general");
197 int gmnemonic = getVKMnemonic("tab.general");
198 pnlGeneral = new GeneralPanel();
199 tpTabs.add(gkey, pnlGeneral);
200 tpTabs.setMnemonicAt(0, gmnemonic);
201
202 String pkey = getMsg("tab.pagesetup");
203 int pmnemonic = getVKMnemonic("tab.pagesetup");
204 pnlPageSetup = new PageSetupPanel();
205 tpTabs.add(pkey, pnlPageSetup);
206 tpTabs.setMnemonicAt(1, pmnemonic);
207
208 String akey = getMsg("tab.appearance");
209 int amnemonic = getVKMnemonic("tab.appearance");
261 Frame frame)
262 {
263 super(frame, getMsg("dialog.pstitle"), true, gc);
264 initPageDialog(x, y, ps, flavor, attributes);
265 }
266
267
268 /**
269 * Initialize "page setup" dialog
270 */
271 void initPageDialog(int x, int y,
272 PrintService ps,
273 DocFlavor flavor,
274 PrintRequestAttributeSet attributes)
275 {
276 this.psCurrent = ps;
277 this.docFlavor = flavor;
278 this.asOriginal = attributes;
279 this.asCurrent = new HashPrintRequestAttributeSet(attributes);
280
281 if (attributes.get(DialogOnTop.class) != null) {
282 setAlwaysOnTop(true);
283 }
284
285 Container c = getContentPane();
286 c.setLayout(new BorderLayout());
287
288 pnlPageSetup = new PageSetupPanel();
289 c.add(pnlPageSetup, BorderLayout.CENTER);
290
291 pnlPageSetup.updateInfo();
292
293 JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
294 btnApprove = createExitButton("button.ok", this);
295 pnlSouth.add(btnApprove);
296 getRootPane().setDefaultButton(btnApprove);
297 btnCancel = createExitButton("button.cancel", this);
298 handleEscKey(btnCancel);
299 pnlSouth.add(btnCancel);
300 c.add(pnlSouth, BorderLayout.SOUTH);
301
302 addWindowListener(new WindowAdapter() {
|
167 * Initialize print dialog.
168 */
169 void initPrintDialog(int x, int y,
170 PrintService[] services,
171 int defaultServiceIndex,
172 DocFlavor flavor,
173 PrintRequestAttributeSet attributes)
174 {
175 this.services = services;
176 this.defaultServiceIndex = defaultServiceIndex;
177 this.asOriginal = attributes;
178 this.asCurrent = new HashPrintRequestAttributeSet(attributes);
179 this.psCurrent = services[defaultServiceIndex];
180 this.docFlavor = flavor;
181 SunPageSelection pages =
182 (SunPageSelection)attributes.get(SunPageSelection.class);
183 if (pages != null) {
184 isAWT = true;
185 }
186
187 if (attributes.get(DialogOwner.class) != null) {
188 DialogOwner owner = (DialogOwner)attributes.get(DialogOwner.class);
189 /* When the ServiceDialog is constructed the caller of the
190 * constructor checks for this attribute and if it specifies a
191 * window then it will use that in the constructor instead of
192 * inferring one from keyboard focus.
193 * In this case the owner of the dialog is the same as that
194 * specified in the attribute and we do not need to set the
195 * on top property
196 */
197 if ((getOwner() == null) || (owner.getOwner() != getOwner())) {
198 setAlwaysOnTop(true);
199 }
200 }
201 Container c = getContentPane();
202 c.setLayout(new BorderLayout());
203
204 tpTabs = new JTabbedPane();
205 tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));
206
207 String gkey = getMsg("tab.general");
208 int gmnemonic = getVKMnemonic("tab.general");
209 pnlGeneral = new GeneralPanel();
210 tpTabs.add(gkey, pnlGeneral);
211 tpTabs.setMnemonicAt(0, gmnemonic);
212
213 String pkey = getMsg("tab.pagesetup");
214 int pmnemonic = getVKMnemonic("tab.pagesetup");
215 pnlPageSetup = new PageSetupPanel();
216 tpTabs.add(pkey, pnlPageSetup);
217 tpTabs.setMnemonicAt(1, pmnemonic);
218
219 String akey = getMsg("tab.appearance");
220 int amnemonic = getVKMnemonic("tab.appearance");
272 Frame frame)
273 {
274 super(frame, getMsg("dialog.pstitle"), true, gc);
275 initPageDialog(x, y, ps, flavor, attributes);
276 }
277
278
279 /**
280 * Initialize "page setup" dialog
281 */
282 void initPageDialog(int x, int y,
283 PrintService ps,
284 DocFlavor flavor,
285 PrintRequestAttributeSet attributes)
286 {
287 this.psCurrent = ps;
288 this.docFlavor = flavor;
289 this.asOriginal = attributes;
290 this.asCurrent = new HashPrintRequestAttributeSet(attributes);
291
292 if (attributes.get(DialogOwner.class) != null) {
293 /* See comments in same block in initPrintDialog */
294 DialogOwner owner = (DialogOwner)attributes.get(DialogOwner.class);
295 if ((getOwner() == null) || (owner.getOwner() != getOwner())) {
296 setAlwaysOnTop(true);
297 }
298 }
299
300 Container c = getContentPane();
301 c.setLayout(new BorderLayout());
302
303 pnlPageSetup = new PageSetupPanel();
304 c.add(pnlPageSetup, BorderLayout.CENTER);
305
306 pnlPageSetup.updateInfo();
307
308 JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
309 btnApprove = createExitButton("button.ok", this);
310 pnlSouth.add(btnApprove);
311 getRootPane().setDefaultButton(btnApprove);
312 btnCancel = createExitButton("button.cancel", this);
313 handleEscKey(btnCancel);
314 pnlSouth.add(btnCancel);
315 c.add(pnlSouth, BorderLayout.SOUTH);
316
317 addWindowListener(new WindowAdapter() {
|