List of usage examples for java.awt PopupMenu setFont
public void setFont(Font f)
From source file:javazoom.jlgui.player.amp.Player.java
/** * Loads a skin from a SkinLoader./* w ww.j a v a2s .c om*/ */ protected void loadSkin(SkinLoader skl) throws Exception { skl.loadImages(); imMain = skl.getImage(theMain); imButtons = skl.getImage(theButtons); imTitleBar = skl.getImage(theTitleBar); imText = skl.getImage(theText); imMode = skl.getImage(theMode); imNumbers = skl.getImage(theNumbers); // add by John Yang if (imNumbers == null) { log.info("Try load nums_ex.bmp !"); imNumbers = skl.getImage(theNumEx); } imVolume = skl.getImage(theVolume); imBalance = skl.getImage(theBalance); imIcons = skl.getImage(theIcons); imPosBar = skl.getImage(thePosBar); imEPSRButtons = skl.getImage(theEPSRButtons); // Computes volume slider height : int vh = (imVolume.getHeight(null) - 422); if (vh > 0) { releasedVolumePanel0[3] = vh; pressedVolumePanel0[3] = vh; releasedVolumePanel1[3] = vh; pressedVolumePanel1[3] = vh; } // Computes balance slider height : if (imBalance == null) imBalance = imVolume; int bh = (imBalance.getHeight(null) - 422); if (bh > 0) { releasedBalancePanel0[3] = bh; pressedBalancePanel0[3] = bh; releasedBalancePanel1[3] = bh; pressedBalancePanel1[3] = bh; } // Compute posbar height. int ph = imPosBar.getHeight(null); if (ph > 0) { releasedPosPanel[3] = ph; pressedPosPanel[3] = ph; } WinHeight = imMain.getHeight(this); // 275 WinWidth = imMain.getWidth(this); // 116 setSize(WinWidth, WinHeight); setLocation(OrigineX, OrigineY); //setBackground(Color.black); show(); offScreenImage = createImage(WinWidth, WinHeight); offScreenGraphics = offScreenImage.getGraphics(); // E.B Fix for JDK 1.4 slow down problem. hide(); // End Fix. offScreenGraphics.drawImage(imMain, 0, 0, this); // M.S : Remove all components when loading a new skin. if (acPrevious != null) remove(acPrevious); if (acPlay != null) remove(acPlay); if (acPause != null) remove(acPause); if (acStop != null) remove(acStop); if (acNext != null) remove(acNext); if (acEject != null) remove(acEject); if (acTitleBar != null) remove(acTitleBar); if (acExit != null) remove(acExit); if (acMinimize != null) remove(acMinimize); if (acVolume != null) remove((Component) acVolume); if (acBalance != null) remove((Component) acBalance); if (acPosBar != null) remove(acPosBar); if (acPlaylist != null) remove(acPlaylist); if (acRepeat != null) remove(acRepeat); if (acShuffle != null) remove(acShuffle); if (acEqualizer != null) remove(acEqualizer); if (fileList != null) fileList.dispose(); if (equalizer != null) equalizer.dispose(); System.gc(); /*-- Buttons --*/ readPanel(releasedImage, releasedPanel, pressedImage, pressedPanel, imButtons); setButtonsPanel(); /*-- Volume/Balance --*/ if (skinVersion.equals("1")) { readPanel(releasedVolumeImage, releasedVolumePanel0, pressedVolumeImage, pressedVolumePanel0, imVolume); readPanel(releasedBalanceImage, releasedBalancePanel0, pressedBalanceImage, pressedBalancePanel0, imBalance); } else { readPanel(releasedVolumeImage, releasedVolumePanel1, pressedVolumeImage, pressedVolumePanel1, imVolume); readPanel(releasedBalanceImage, releasedBalancePanel1, pressedBalanceImage, pressedBalancePanel1, imBalance); } setVolumeBalancePanel(vh, bh); /*-- Title Bar --*/ readPanel(releasedTitleIm, releasedTitlePanel, pressedTitleIm, pressedTitlePanel, imTitleBar); setTitleBarPanel(); /*-- Exit --*/ readPanel(releasedExitIm, releasedExitPanel, pressedExitIm, pressedExitPanel, imTitleBar); setExitPanel(); /*-- Minimize --*/ readPanel(releasedMinimizeIm, releasedMinimizePanel, pressedMinimizeIm, pressedMinimizePanel, imTitleBar); setMinimizePanel(); /*-- Mode --*/ readPanel(activeModeImage, activeModePanel, passiveModeImage, passiveModePanel, imMode); offScreenGraphics.drawImage(passiveModeImage[0], stereoLocation[0], stereoLocation[1], this); offScreenGraphics.drawImage(passiveModeImage[1], monoLocation[0], monoLocation[1], this); /*-- Text --*/ sampleRateClearImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, sampleRateClearText)) .getBanner(); bitsRateClearImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, bitsRateClearText)) .getBanner(); clearImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, clearText)).getBanner(0, 0, 155, 6); titleImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, titleText)).getBanner(0, 0, 155, 6); offScreenGraphics.drawImage(titleImage, titleLocation[0], titleLocation[1], this); /*-- Numbers --*/ for (int h = 0; h < numberIndex.length(); h++) { timeImage[h] = (new Taftb(numberIndex, imNumbers, numberWidth, numberHeight, 0, "" + numberIndex.charAt(h))).getBanner(); } /*-- Icons --*/ readPanel(iconsImage, iconsPanel, null, null, imIcons); offScreenGraphics.drawImage(iconsImage[2], iconsLocation[0], iconsLocation[1], this); /*-- Pos Bar --*/ readPanel(releasedPosIm, releasedPosPanel, pressedPosIm, pressedPosPanel, imPosBar); setPosBarPanel(); /*-- Equalizer/Playlist/Shuffle/Repeat --*/ readPanel(releasedEPSRImage, releasedEPSRPanel, pressedEPSRImage, pressedEPSRPanel, imEPSRButtons); setEPSRButtonsPanel(); // Popup menu on TitleBar PopupMenu mainpopup = new PopupMenu("Setup"); Font fnt = new Font("Dialog", Font.PLAIN, 11); mainpopup.setFont(fnt); MenuItem mi = new MenuItem(TITLETEXT + "- JavaZOOM"); //mi.setEnabled(false); mi.addActionListener(this); mainpopup.add(mi); mainpopup.addSeparator(); mi = new MenuItem("Preferences"); // TODO mi.setEnabled(false); mi.addActionListener(this); mainpopup.add(mi); mi = new MenuItem("Load Skin"); //mi.setEnabled(false); mi.addActionListener(this); mainpopup.add(mi); //mainpopup.addSeparator(); mi = new MenuItem("Exit"); mi.addActionListener(this); mainpopup.add(mi); acTitleBar.setPopup(mainpopup); /* -- create MP3File List Window --*/ if (showPlaylist != null) config.setPlaylistEnabled(true); fileList = new MP3Files(topFrame, this, playlist, skl, OrigineX, OrigineY + WinHeight, config.isPlaylistEnabled()); /* -- create Equalizer Window --*/ if (showEqualizer != null) config.setEqualizerEnabled(true); int factor = 1; if (config.isPlaylistEnabled()) factor = 2; equalizer = new Equalizer(topFrame, this, skl, OrigineX, OrigineY + WinHeight * factor, config.isEqualizerEnabled()); show(); }
From source file:javazoom.jlgui.player.amp.PlayerApplet.java
/** * Loads a skin from a SkinLoader.//from w ww . j a v a 2s .c o m */ protected void loadSkin(SkinLoader skl) throws Exception { skl.loadImages(); imMain = skl.getImage(theMain); imButtons = skl.getImage(theButtons); imTitleBar = skl.getImage(theTitleBar); imText = skl.getImage(theText); imMode = skl.getImage(theMode); imNumbers = skl.getImage(theNumbers); // add by John Yang if (imNumbers == null) { log.info("Try load nums_ex.bmp !"); imNumbers = skl.getImage(theNumEx); } imVolume = skl.getImage(theVolume); imBalance = skl.getImage(theBalance); imIcons = skl.getImage(theIcons); imPosBar = skl.getImage(thePosBar); imEPSRButtons = skl.getImage(theEPSRButtons); // Computes volume slider height : int vh = (imVolume.getHeight(null) - 422); if (vh > 0) { releasedVolumePanel0[3] = vh; pressedVolumePanel0[3] = vh; releasedVolumePanel1[3] = vh; pressedVolumePanel1[3] = vh; } // Computes balance slider height : if (imBalance == null) imBalance = imVolume; int bh = (imBalance.getHeight(null) - 422); if (bh > 0) { releasedBalancePanel0[3] = bh; pressedBalancePanel0[3] = bh; releasedBalancePanel1[3] = bh; pressedBalancePanel1[3] = bh; } // Compute posbar height. int ph = imPosBar.getHeight(null); if (ph > 0) { releasedPosPanel[3] = ph; pressedPosPanel[3] = ph; } WinHeight = imMain.getHeight(this); // 275 WinWidth = imMain.getWidth(this); // 116 setSize(WinWidth, WinHeight); setLocation(OrigineX, OrigineY); //setBackground(Color.black); show(); offScreenImage = createImage(WinWidth, WinHeight); offScreenGraphics = offScreenImage.getGraphics(); // E.B Fix for JDK 1.4 slow down problem. hide(); // End Fix. offScreenGraphics.drawImage(imMain, 0, 0, this); // M.S : Remove all components when loading a new skin. if (acPrevious != null) remove(acPrevious); if (acPlay != null) remove(acPlay); if (acPause != null) remove(acPause); if (acStop != null) remove(acStop); if (acNext != null) remove(acNext); if (acEject != null) remove(acEject); if (acTitleBar != null) remove(acTitleBar); if (acExit != null) remove(acExit); if (acMinimize != null) remove(acMinimize); if (acVolume != null) remove((Component) acVolume); if (acBalance != null) remove((Component) acBalance); if (acPosBar != null) remove(acPosBar); if (acPlaylist != null) remove(acPlaylist); if (acRepeat != null) remove(acRepeat); if (acShuffle != null) remove(acShuffle); if (acEqualizer != null) remove(acEqualizer); if (fileList != null) remove(fileList); if (equalizer != null) remove(equalizer); System.gc(); /*-- Buttons --*/ readPanel(releasedImage, releasedPanel, pressedImage, pressedPanel, imButtons); setButtonsPanel(); /*-- Volume/Balance --*/ if (skinVersion.equals("1")) { readPanel(releasedVolumeImage, releasedVolumePanel0, pressedVolumeImage, pressedVolumePanel0, imVolume); readPanel(releasedBalanceImage, releasedBalancePanel0, pressedBalanceImage, pressedBalancePanel0, imBalance); } else { readPanel(releasedVolumeImage, releasedVolumePanel1, pressedVolumeImage, pressedVolumePanel1, imVolume); readPanel(releasedBalanceImage, releasedBalancePanel1, pressedBalanceImage, pressedBalancePanel1, imBalance); } setVolumeBalancePanel(vh, bh); /*-- Title Bar --*/ readPanel(releasedTitleIm, releasedTitlePanel, pressedTitleIm, pressedTitlePanel, imTitleBar); setTitleBarPanel(); /*-- Exit --*/ readPanel(releasedExitIm, releasedExitPanel, pressedExitIm, pressedExitPanel, imTitleBar); setExitPanel(); /*-- Minimize --*/ readPanel(releasedMinimizeIm, releasedMinimizePanel, pressedMinimizeIm, pressedMinimizePanel, imTitleBar); setMinimizePanel(); /*-- Mode --*/ readPanel(activeModeImage, activeModePanel, passiveModeImage, passiveModePanel, imMode); offScreenGraphics.drawImage(passiveModeImage[0], stereoLocation[0], stereoLocation[1], this); offScreenGraphics.drawImage(passiveModeImage[1], monoLocation[0], monoLocation[1], this); /*-- Text --*/ sampleRateClearImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, sampleRateClearText)) .getBanner(); bitsRateClearImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, bitsRateClearText)) .getBanner(); clearImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, clearText)).getBanner(0, 0, 155, 6); titleImage = (new Taftb(fontIndex, imText, fontWidth, fontHeight, 0, titleText)).getBanner(0, 0, 155, 6); offScreenGraphics.drawImage(titleImage, titleLocation[0], titleLocation[1], this); /*-- Numbers --*/ for (int h = 0; h < numberIndex.length(); h++) { timeImage[h] = (new Taftb(numberIndex, imNumbers, numberWidth, numberHeight, 0, "" + numberIndex.charAt(h))).getBanner(); } /*-- Icons --*/ readPanel(iconsImage, iconsPanel, null, null, imIcons); offScreenGraphics.drawImage(iconsImage[2], iconsLocation[0], iconsLocation[1], this); /*-- Pos Bar --*/ readPanel(releasedPosIm, releasedPosPanel, pressedPosIm, pressedPosPanel, imPosBar); setPosBarPanel(); /*-- Equalizer/Playlist/Shuffle/Repeat --*/ readPanel(releasedEPSRImage, releasedEPSRPanel, pressedEPSRImage, pressedEPSRPanel, imEPSRButtons); setEPSRButtonsPanel(); // Popup menu on TitleBar PopupMenu mainpopup = new PopupMenu("Setup"); Font fnt = new Font("Dialog", Font.PLAIN, 11); mainpopup.setFont(fnt); MenuItem mi = new MenuItem(TITLETEXT + "- JavaZOOM"); mi.setEnabled(false); mi.addActionListener(this); mainpopup.add(mi); mainpopup.addSeparator(); mi = new MenuItem("Preferences"); mi.setEnabled(false); mi.addActionListener(this); mainpopup.add(mi); mi = new MenuItem("Skins"); mi.setEnabled(false); mi.addActionListener(this); mainpopup.add(mi); mainpopup.addSeparator(); mi = new MenuItem("Exit"); mi.setEnabled(false); mi.addActionListener(this); mainpopup.add(mi); acTitleBar.setPopup(mainpopup); /* -- create MP3File List Window --*/ if (showPlaylist != null) config.setPlaylistEnabled(true); fileList = new MP3FilesApplet(topFrame, this, playlist, skl, OrigineX, OrigineY + WinHeight, config.isPlaylistEnabled()); add(fileList); /* -- create Equalizer Window --*/ if (showEqualizer != null) config.setEqualizerEnabled(true); int factor = 1; if (config.isPlaylistEnabled()) factor = 2; equalizer = new EqualizerApplet(topFrame, this, skl, OrigineX, OrigineY + WinHeight * factor, config.isEqualizerEnabled()); add(equalizer); show(); }