pack();
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
protected void createContent(){
Container content = getContentPane();
content.setLayout(new BorderLayout());
// HeaderPanel
headerPanel = new HeaderPanel(true);
headerPanel.setTitle(resources.getString("print"));
content.add(headerPanel, BorderLayout.NORTH);
// Inner panel
GridBagPanel printPanel = new GridBagPanel();
GridBagPanel printerPanel = new GridBagPanel( resources.getStringValue("printer") );
GridBagPanel selectionPanel = new GridBagPanel( resources.getStringValue("selection") );
GridBagPanel copiesPanel = new GridBagPanel(resources.getStringValue("copies") );
GridBagPanel paperSizePanel = new GridBagPanel( resources.getStringValue("paperSize"));
GridBagPanel paperOrientationPanel = new GridBagPanel( resources.getStringValue("paperOrientation"));
// printer
printerList = new JComboBox(printServices);
printerPropertiesButton = resources.getButton("propertiesButton", this);
// TODO fix the bug when editing printer properties on Linux OS
printerPropertiesButton.setEnabled(false);
printerList.addActionListener(this);
JLabel lname = resources.getLabel("name");
printerPanel.addOnCurrentRow(lname);
printerPanel.addOnCurrentRow(printerList, 2);
printerPanel.addOnCurrentRow(printerPropertiesButton);
printerPanel.carriageReturn();
// Selection
printAllButton = resources.getRadioButton("printAll", null);
printSelectedButton = resources.getRadioButton("printSelected", null);
ButtonGroup printButtonGroup = new ButtonGroup();
printButtonGroup.add(printAllButton);
printButtonGroup.add(printSelectedButton);
selectionPanel.addOnCurrentRow(printAllButton);
selectionPanel.carriageReturn();
selectionPanel.addOnCurrentRow(printSelectedButton);
selectionPanel.carriageReturn();
// Number of copies
JLabel lnbCopies = resources.getLabel("nbCopies");
SpinnerNumberModel spiNbCopies = new SpinnerNumberModel();
spiNbCopies.setStepSize(new Integer(1));
spiNbCopies.setMinimum(new Integer(1));
spiNbCopies.setMaximum(new Integer(100));
spiNbCopies.setValue(new Integer(1));
nbCopies = new JSpinner(spiNbCopies);
copiesPanel.addOnCurrentRow(lnbCopies);
copiesPanel.addOnCurrentRow(nbCopies, 1, true, false, true);
copiesPanel.carriageReturn();
// Paper size
paperNameList = new JComboBox(paperNames);
paperNameList.setSelectedIndex(0);
JLabel lpaper = resources.getLabel("paper");
paperSizePanel.addOnCurrentRow(lpaper);
paperSizePanel.addOnCurrentRow(paperNameList,1, true, false, true);
paperSizePanel.addOnCurrentRow( cbzoom = resources.getCheckBox("updateToPaper", null), 2, false, false, true);
cbzoom.setSelected(true);
// Orientation
portraitButton = resources.getRadioButton("portraitOrientation", null);
landscapeButton = resources.getRadioButton("landscapeOrientation", null);
reverseLandscapeButton = resources.getRadioButton("reverseLandscapeOrientation", null);
ButtonGroup paperOrientationGroup = new ButtonGroup();
paperOrientationGroup.add(portraitButton);
paperOrientationGroup.add(landscapeButton);
paperOrientationGroup.add(reverseLandscapeButton);
portraitButton.setSelected(true);
landscapeButton.setSelected(false);
reverseLandscapeButton.setSelected(false);
paperOrientationPanel.addOnCurrentRow(portraitButton);
paperOrientationPanel.carriageReturn();
paperOrientationPanel.addOnCurrentRow(landscapeButton);
paperOrientationPanel.carriageReturn();
paperOrientationPanel.addOnCurrentRow(reverseLandscapeButton);
paperOrientationPanel.carriageReturn();
// Add all panels
printPanel.addOnCurrentRow(printerPanel, 4, true, true, true);
printPanel.addOnCurrentRow(selectionPanel, 2, true, true, false);
printPanel.addOnCurrentRow(copiesPanel, 2, true, true, true);
printPanel.addOnCurrentRow(paperSizePanel, 1, true, true, false);
printPanel.addOnCurrentRow(paperOrientationPanel, 1, true, true, true);
printPanel.addOnCurrentRow( cbbackground = resources.getCheckBox("printBackground", null), 2, false, false, true);
cbbackground.setSelected(false);
content.add(printPanel, BorderLayout.CENTER);
// Buttons
JPanel navigationBarPanel = new JPanel(new BorderLayout());
JPanel navigationBar = new JPanel();
closeButton = resources.getButton("closeButton", this);
okButton = resources.getButton("okButton", this);
navigationBar.add(okButton);
navigationBar.add(closeButton);
navigationBarPanel.add(navigationBar, BorderLayout.EAST);
content.add(navigationBarPanel,BorderLayout.SOUTH);
}