< prev index next >

src/java.desktop/share/classes/sun/print/ServiceDialog.java

Print this page




 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");


 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                 try {
 199                     setAlwaysOnTop(true);
 200                 } catch (SecurityException e) {
 201                 }
 202             }
 203         }
 204         Container c = getContentPane();
 205         c.setLayout(new BorderLayout());
 206 
 207         tpTabs = new JTabbedPane();
 208         tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));
 209 
 210         String gkey = getMsg("tab.general");
 211         int gmnemonic = getVKMnemonic("tab.general");
 212         pnlGeneral = new GeneralPanel();
 213         tpTabs.add(gkey, pnlGeneral);
 214         tpTabs.setMnemonicAt(0, gmnemonic);
 215 
 216         String pkey = getMsg("tab.pagesetup");
 217         int pmnemonic = getVKMnemonic("tab.pagesetup");
 218         pnlPageSetup = new PageSetupPanel();
 219         tpTabs.add(pkey, pnlPageSetup);
 220         tpTabs.setMnemonicAt(1, pmnemonic);
 221 
 222         String akey = getMsg("tab.appearance");


 275                          Frame frame)
 276     {
 277         super(frame, getMsg("dialog.pstitle"), true, gc);
 278         initPageDialog(x, y, ps, flavor, attributes);
 279     }
 280 
 281 
 282     /**
 283      * Initialize "page setup" dialog
 284      */
 285     void initPageDialog(int x, int y,
 286                          PrintService ps,
 287                          DocFlavor flavor,
 288                          PrintRequestAttributeSet attributes)
 289     {
 290         this.psCurrent = ps;
 291         this.docFlavor = flavor;
 292         this.asOriginal = attributes;
 293         this.asCurrent = new HashPrintRequestAttributeSet(attributes);
 294 
 295         if (attributes.get(DialogOwner.class) != null) {
 296             /* See comments in same block in initPrintDialog */
 297             DialogOwner owner = (DialogOwner)attributes.get(DialogOwner.class);
 298             if ((getOwner() == null) || (owner.getOwner() != getOwner())) {
 299                 try {
 300                     setAlwaysOnTop(true);
 301                 } catch (SecurityException e) {
 302                 }
 303             }
 304         }
 305 
 306         Container c = getContentPane();
 307         c.setLayout(new BorderLayout());
 308 
 309         pnlPageSetup = new PageSetupPanel();
 310         c.add(pnlPageSetup, BorderLayout.CENTER);
 311 
 312         pnlPageSetup.updateInfo();
 313 
 314         JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
 315         btnApprove = createExitButton("button.ok", this);
 316         pnlSouth.add(btnApprove);
 317         getRootPane().setDefaultButton(btnApprove);
 318         btnCancel = createExitButton("button.cancel", this);
 319         handleEscKey(btnCancel);
 320         pnlSouth.add(btnCancel);
 321         c.add(pnlSouth, BorderLayout.SOUTH);
 322 
 323         addWindowListener(new WindowAdapter() {


< prev index next >