/* Applet skeleton
* @author :
* Date :
*/
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
public class AppletName extends JApplet
{
//Movie Tab Declarations
JPanel applet;
// Movie Tab Declarations
JLabel title, moviesimagelabel, movietitle, moviedateacquired, movieinfolabel;
JTabbedPane tabs;
JList movieslist;
DefaultListModel model;
JScrollPane scrollmovieslist, scrollmovieinfotextarea;
Image moviesimage;
ImageIcon moviesicon;
Border moviesborder;
JTextArea movieinfotextarea;
//*********************************************************
public void init( )
{
doFirst();
doMoviesTab( );
doMusicTab( );
doGamesTab( );
doAddTab( );
}
//*********************************************************
public void doFirst( )
{
applet = new JPanel();
applet.setLayout(new BorderLayout());
this.setSize(new Dimension(600, 400));
UIManager.put("Tabbedpane.selected", new javax.swing.plaf.ColorUIResource(Color.red));
UIManager.put("Tabbedpane.contentAreaColor", new javax.swing.plaf.ColorUIResource(Color.red));
UIManager.put("Tabbedpane.background", new javax.swing.plaf.ColorUIResource(Color.red));
UIManager.put("Tabbedpane.shadow", new javax.swing.plaf.ColorUIResource(Color.red));
UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));
title = new JLabel("<html><font size=18>Media Collection Manager</font>");
tabs = new JTabbedPane(JTabbedPane.TOP);
title.setOpaque(true);
tabs.setOpaque(true);
//title.setBackground(Color.black);
//title.setForeground(Color.lightGray);
//tabs.setBackground(Color.black);
//tabs.setForeground(Color.lightGray);
applet.add(title, BorderLayout.NORTH);
applet.add(tabs, BorderLayout.CENTER);
add(applet);
}
//*********************************************************
public void doMoviesTab( )
{
//Panels
JPanel moviespanel = new JPanel( );
JPanel himoviespanel = new JPanel();
JPanel lomoviespanel = new JPanel();
//Layouts
himoviespanel.setLayout(new GridLayout(1,2));
lomoviespanel.setLayout(new BorderLayout());
//Upper Components
model = new DefaultListModel();
movieslist = new JList(model);
scrollmovieslist = new JScrollPane(movieslist);
moviesimage = getImage(getCodeBase(), "placeholder.gif");
moviesicon = new ImageIcon(moviesimage);
moviesimagelabel = new JLabel(moviesicon);
//Lower Components
moviesborder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
movietitle = new JLabel("Movie Title");
movieinfolabel = new JLabel("Placeholder");
movieinfotextarea = new JTextArea("Placeholder Text. Placeholder Text. Placeholder Text. Placeholder Text. Placeholder Text.");
scrollmovieinfotextarea = new JScrollPane(movieinfotextarea);
moviedateacquired = new JLabel("Date Acquired");
//Cosmetic Stuff
movieinfotextarea.setEditable(false);
movieinfotextarea.setLineWrap(true);
movieinfotextarea.setWrapStyleWord(true);
movieinfolabel.setBorder(moviesborder);
movieinfolabel.setPreferredSize(new Dimension(250,150));
movieinfotextarea.setPreferredSize(new Dimension(250, 150));
//Colors
scrollmovieslist.setOpaque(true);
scrollmovieslist.setBackground(Color.black);
scrollmovieslist.setForeground(Color.lightGray);
moviesimagelabel.setOpaque(true);
moviesimagelabel.setBackground(Color.black);
moviesimagelabel.setForeground(Color.lightGray);
movietitle.setOpaque(true);
movietitle.setBackground(Color.black);
movietitle.setForeground(Color.lightGray);
movieinfolabel.setOpaque(true);
movieinfolabel.setBackground(Color.black);
movieinfolabel.setForeground(Color.lightGray);
scrollmovieinfotextarea.setOpaque(true);
scrollmovieinfotextarea.setBackground(Color.black);
scrollmovieinfotextarea.setForeground(Color.lightGray);
moviedateacquired.setOpaque(true);
moviedateacquired.setBackground(Color.black);
moviedateacquired.setForeground(Color.lightGray);
himoviespanel.setOpaque(true);
himoviespanel.setBackground(Color.black);
himoviespanel.setForeground(Color.lightGray);
lomoviespanel.setOpaque(true);
lomoviespanel.setBackground(Color.black);
lomoviespanel.setForeground(Color.lightGray);
moviespanel.setOpaque(true);
moviespanel.setBackground(Color.black);
moviespanel.setForeground(Color.lightGray);
//Add components to panels
himoviespanel.add(scrollmovieslist);
himoviespanel.add(moviesimagelabel);
lomoviespanel.add(movietitle, BorderLayout.NORTH);
lomoviespanel.add(movieinfolabel, BorderLayout.WEST);
lomoviespanel.add(scrollmovieinfotextarea, BorderLayout.CENTER);
lomoviespanel.add(moviedateacquired, BorderLayout.SOUTH);
//Add panels to tab
moviespanel.add(himoviespanel);
moviespanel.add(lomoviespanel);
//Add tab
//tabs.setBackgroundAt(1, Color.RED);
//tabs.setForegroundAt(1, Color.GREEN);
tabs.addTab("Movies", null, moviespanel, "Browse your movie collection");
}
//*********************************************************
public void doMusicTab( )
{
JPanel musicpanel = new JPanel( );
//tabs.setBackgroundAt(2, Color.darkGray);
//tabs.setForegroundAt(2, Color.lightGray);
tabs.addTab("Music", null, musicpanel, "Browse your music collection");
}
//*********************************************************
public void doGamesTab( )
{
JPanel gamespanel = new JPanel( );
//tabs.setBackgroundAt(3, Color.darkGray);
//tabs.setForegroundAt(3, Color.lightGray);
tabs.addTab("Games", null, gamespanel, "Browse your game collection");
}
//*********************************************************
public void doAddTab( )
{
JPanel addpanel = new JPanel( );
//tabs.setBackgroundAt(4, Color.darkGray);
//tabs.setForegroundAt(3, Color.lightGray);
tabs.addTab("Add New", null, addpanel, "Add new items to your collection");
}
}