public static void gui() throws IOException { // make ui look like other programs on native system // **************************************************************** try { // Set System L&F UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { // handle exception } // ***************************************************************** // setup ui frame frame = new JFrame("Rubber Ducky Simulator"); frame.setSize(680, 600); frame.setResizable(true); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.getContentPane().setLayout(new FlowLayout()); Image icon = ImageIO.read(DuckyEmulator.class.getResource("icon.png")); frame.setIconImage(icon); // *************************************************************** // create button that launches the ducky script run = new JButton("RUN SCRIPT"); run.setBackground(Color.red); // *************************************************************** // create button that opens file select window to choose ducky script open = new JButton("CHOOSE SCRIPT"); open.setBackground(Color.CYAN.darker()); // ********************************************************** // create text area that will display script to allow easier reviewing box = new JTextArea(); box = new JTextArea(28, 55); box.setText(instructions + ducky); JScrollPane scrollPane = new JScrollPane(box); // make scrollable, some scripts are pretty long...... box.setBackground(new Color(200, 200, 255, 255)); box.setEditable(false); box.setVisible(true); // *********************************************************** // add all ui components to frame frame.add(open); frame.add(run); frame.add(scrollPane); frame.setVisible(true); }
@Override public int getColor(VisualItem item) { // get value for target attr in item if (item.canGetString(colorAttrName)) { String attrVal = item.getString(colorAttrName); Color attrValColor = catToColorMap.get(attrVal); if (attrValColor == null) { return Color.CYAN.getRGB(); } return attrValColor.getRGB(); } Color white = Color.WHITE; return white.getRGB(); }
/** Creates a new instance of Cyan */ public Cyan() { super(java.awt.Color.CYAN.getRGB()); }