001 /* PAVLOV -- Multiple Choice Study System 002 * Copyright (C) 2000 - 2004 T.J. Willis 003 * 004 * This program is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU General Public License 006 * as published by the Free Software Foundation; either version 2 007 * of the License, or (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program; if not, write to the Free Software 016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. 017 * 018 * $Header: /cvsroot/pavlov/net/sourceforge/pavlov/feedback/old/AbstractFeedbackPanel.java,v 1.7 2004/07/01 05:50:19 tj_willis Exp $ 019 */ 020 package net.sourceforge.pavlov.feedback.old; 021 import javax.swing.*; 022 import java.awt.Dimension; 023 import java.awt.event.*; 024 import net.sourceforge.pavlov.pluglets.feedback.*; 025 import net.sourceforge.pavlov.event.*; 026 import net.sourceforge.pavlov.main.standalone.ResourceBroker; 027 028 /** 029 * <code>AbstractFeedbackPanel</code> 030 * 031 * @version $Revision: 1.7 $ 032 */ 033 public abstract class AbstractFeedbackPanel extends AbstractFeedbackPluglet 034 implements AnswerListener, ActionListener { 035 //protected Container contentPane; 036 //protected Box box; 037 //protected boolean enabled; 038 //FIXME: get strings from ResourceBroker 039 040 //protected ResourceBroker rb; 041 042 /** Creates new form AbstractFeedbackPanel */ 043 public AbstractFeedbackPanel() { 044 super(); 045 //rb = ResourceBroker.getInstance(); 046 //initComponents(); 047 } 048 049 050 public String getDescription() 051 { 052 return "Old-style audio feedback"; 053 } 054 055 /** This method is called from within the constructor to 056 * initialize the form. 057 */ 058 public void init() { 059 // this layout, obviously, was computer generated 060 super.init(); 061 jPanel2 = new javax.swing.JPanel(); 062 //jPanel6 = new javax.swing.JPanel(); 063 //jLabel2 = new javax.swing.JLabel(); 064 jLabel3 = new javax.swing.JLabel(); 065 jLabel4 = new javax.swing.JLabel(); 066 //jPanel4 = new javax.swing.JPanel(); 067 //jScrollPane1 = new javax.swing.JScrollPane(); 068 imageLabel = new javax.swing.JLabel(); 069 jPanel5 = new javax.swing.JPanel(); 070 jCheckBox1 = new javax.swing.JCheckBox(); 071 jLabel7 = new javax.swing.JLabel(); 072 073 getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS)); 074 075 setBackground(java.awt.Color.white); 076 //setClosable(false); FIXME: changed in MVC push 7apr04 077 setForeground(java.awt.Color.black); 078 //setIconifiable(true); FIXME: changed in MVC push 7apr04 079 //setResizable(true); FIXME: changed in MVC push 7apr04 080 //setTitle("Expert: foo.jpg"); 081 //setAutoscrolls(true); FIXME: changed in MVC push 7apr04 082 jPanel2.setLayout(new java.awt.GridLayout(3, 1)); 083 084 jPanel2.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); 085 //jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); 086 //jLabel2.setText(getName() + " is"); 087 //jPanel6.add(jLabel2); 088 089 //jPanel2.add(jPanel6); 090 091 //jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); 092 jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 093 jLabel3.setText("No Items Currently Available"); 094 jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); 095 jPanel2.add(jLabel3); 096 097 //jLabel4.setFont(new java.awt.Font("Arial", 0, 14)); 098 jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 099 jLabel4.setText("Image Size : n/a"); 100 //jLabel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); 101 jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); 102 jPanel2.add(jLabel4); 103 104 getContentPane().add(jPanel2); 105 106 //imageLabel.setText("xxx"); 107 imageLabel.setMaximumSize(new java.awt.Dimension(100, 100)); 108 imageLabel.setMinimumSize(new java.awt.Dimension(100, 100)); 109 imageLabel.setPreferredSize(new java.awt.Dimension(200, 200)); 110 jScrollPane1 = new JScrollPane(imageLabel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); 111 112 //,h);//.setViewportView(imageLabel); 113 114 //jPanel4.add(jScrollPane1); 115 116 //getContentPane().add(jPanel4); 117 getContentPane().add(jScrollPane1); 118 119 jPanel5.setLayout(new java.awt.BorderLayout()); 120 121 //jCheckBox1.setFont(new java.awt.Font("Arial", 0, 12)); 122 jCheckBox1.setText("Sticky"); 123 jCheckBox1.setToolTipText("Check this button to keep this image onscreen."); 124 jPanel5.add(jCheckBox1, java.awt.BorderLayout.NORTH); 125 126 //jLabel7.setFont(new java.awt.Font("Arial", 0, 12)); 127 jLabel7.setText("From Directory: n/a"); 128 JScrollPane sp0 = new JScrollPane(jLabel7,JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); //HERE 129 sp0.setPreferredSize(new java.awt.Dimension(100,40)); 130 jPanel5.add(sp0, java.awt.BorderLayout.CENTER); 131 132 getContentPane().add(jPanel5); 133 134 pack(); 135 } 136 137 public abstract String getName(); 138 139 protected void setDirectoryName(String who) 140 { 141 jLabel7.setText("From Directory: " + who); 142 } 143 144 protected void setNumberOfActiveItems(long size) 145 { 146 jLabel3.setText("" + size + " Items Available"); 147 } 148 protected void setTopMessage(String m) 149 { 150 jLabel3.setText(m); 151 } 152 protected void setImageSize(long sz) 153 { 154 int size = (int)sz; 155 if(size>1400) size = 1400; // KLUDGE: limits OutOfMemoryErrors 156 jLabel4.setText("Image Size is: " + size); 157 imageLabel.setMaximumSize(new Dimension(size, size)); 158 imageLabel.setPreferredSize(new Dimension(size, size)); 159 imageLabel.setMinimumSize(new Dimension(size, size)); 160 } 161 162 protected void setMessage(String msg) 163 { 164 jLabel4.setText(msg); 165 } 166 167 // Variables declaration - do not modify 168 private javax.swing.JPanel jPanel2; 169 //private javax.swing.JPanel jPanel6; 170 //private javax.swing.JLabel jLabel2; 171 private javax.swing.JLabel jLabel3; 172 protected javax.swing.JLabel jLabel4; 173 //private javax.swing.JPanel jPanel4; 174 private javax.swing.JScrollPane jScrollPane1; 175 protected javax.swing.JLabel imageLabel; 176 private javax.swing.JPanel jPanel5; 177 protected javax.swing.JCheckBox jCheckBox1; 178 protected javax.swing.JLabel jLabel7; 179 // End of variables declaration 180 181 } 182 183 184 185 186 187 188 189