public ConverterPanel(CFrame F, ConvertibleValue CV) { super(new GridBagLayout()); // call to super must be first statement in constructor setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.blue)); frame = F; cValue = CV; preferedSize = new Dimension(100, 40); setBackground(white); } // constructor
// int jlabel3_state=0; public void mouseClicked(MouseEvent e) { JLabel source = (JLabel) e.getSource(); if (label_state.get(source) == 0) { if (source.getName() == "jLabel11") { if (challenge_file == null) { JOptionPane.showMessageDialog(null, "Challenge File Not Loaded"); } else { reset_labelState(); active_label = (JLabel) source; label_state.put(source, 1); try { ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource("resources/images/pause.jpg")); jLabel11.setIcon(icon); } catch (Exception et) { JOptionPane.showMessageDialog(null, et.toString()); } } } else { reset_labelState(); active_label = (JLabel) source; label_state.put(source, 1); } source.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLUE)); } else { active_label = null; label_state.put(source, 0); if (source.getName() == "jLabel11") { try { ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource("resources/images/play.jpg")); jLabel11.setIcon(icon); } catch (Exception et) { JOptionPane.showMessageDialog(null, et.toString()); } } source.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLUE)); } }
public void setGoal(File file) throws FileNotFoundException, IOException { FileInputStream fstream = new FileInputStream(file); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; // Read File Line By Line strLine = br.readLine(); input_count = Integer.valueOf(br.readLine()); results = new String[input_count]; tapes = new String[input_count]; for (int i = 0; i < input_count; i++) { results[i] = br.readLine(); tapes[i] = br.readLine(); } jLabel1.setText(strLine); jLabel1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK)); br.close(); }
public void reset_labelState() { for (int i = 2; i < 12; i++) { labels[i].setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLUE)); label_state.put(labels[i], 0); } }