1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.net.URL;
import java.net.*;
import java.io.*;
import com.easysw.cups.*;
public class GLPtabs extends JPanel
{
JTabbedPane tabPanel = null;
//
// Panels for the various tabs.
//
JPanel serverPanel = null;
JScrollPane printersPanel = null;
JPanel detailPanel = null;
JPanel optionsPanel = null;
GLPserver server = null;
GLPprinters printers = null;
GLPdetail detail = null;
GLPoptions options = null;
// Constructor
public GLPtabs()
{
tabPanel = new JTabbedPane();
tabPanel.setBackground(Color.white);
serverPanel = new JPanel();
server = new GLPserver();
serverPanel = server.getPanel();
tabPanel.add("Server", serverPanel);
tabPanel.setBackgroundAt(0,GLPcolors.tabBackgroundColor);
tabPanel.setForegroundAt(0,GLPcolors.tabForegroundColor);
printersPanel = new JScrollPane();
printers = new GLPprinters();
printersPanel = printers.getPanel();
tabPanel.add( "Printers", printersPanel );
tabPanel.setBackgroundAt(1,GLPcolors.tabBackgroundColor);
tabPanel.setForegroundAt(1,GLPcolors.tabForegroundColor);
detail = new GLPdetail();
detailPanel = detail.getPanel();
tabPanel.add( "Destination", detailPanel );
tabPanel.setBackgroundAt(2,GLPcolors.tabBackgroundColor);
tabPanel.setForegroundAt(2,GLPcolors.tabForegroundColor);
options = new GLPoptions();
optionsPanel = new JPanel();
optionsPanel.setBackground(GLPcolors.backgroundColor);
tabPanel.add( "Options", optionsPanel );
tabPanel.setBackgroundAt(3,GLPcolors.tabBackgroundColor);
tabPanel.setForegroundAt(3,GLPcolors.tabForegroundColor);
tabPanel.setSelectedIndex(0);
tabPanel.addChangeListener(new ChangeListener()
{
public void stateChanged( ChangeEvent e )
{
Object source = e.getSource();
if (!printers.cupsServerName.equals(GLPvars.getServerName()))
{
printers.load();
printersPanel = printers.getPanel();
tabPanel.setComponentAt(1,printersPanel);
}
}
});
JPanel jobsPanel = new JPanel();
JPanel filePanel = new JPanel();
}
public void updateServerPanel(String s)
{
server.updateServer(s);
serverPanel = server.getPanel();
tabPanel.setComponentAt(0,serverPanel);
}
public void updateDetailPanel()
{
detail.topDetail();
detailPanel = detail.getPanel();
tabPanel.setComponentAt(2,detailPanel);
}
public void updateOptionsPanel(CupsPrinter cp)
{
options.updateOptions(cp);
optionsPanel = options.getPanel();
tabPanel.setComponentAt(3,optionsPanel);
}
public boolean updatePrintersTab()
{
return(true);
}
public JTabbedPane getPanel()
{
return(tabPanel);
}
}
|