private void updateDisplay() { // first, set block colours textView.setBackground(getColour(backgroundColour("text-background-colour"))); textView.setForeground(getColour(foregroundColour("text-foreground-colour"))); textView.setCaretColor(getColour(foregroundColour("text-caret-colour"))); problemsView.setBackground(getColour(backgroundColour("problems-background-colour"))); problemsView.setForeground(getColour(foregroundColour("problems-foreground-colour"))); consoleView.setBackground(getColour(backgroundColour("console-background-colour"))); consoleView.setForeground(getColour(foregroundColour("console-foreground-colour"))); // second, set colours on the code! java.util.List<Lexer.Token> tokens = Lexer.tokenise(textView.getText(), true); int pos = 0; for (Lexer.Token t : tokens) { int len = t.toString().length(); if (t instanceof Lexer.RightBrace || t instanceof Lexer.LeftBrace) { highlightArea(pos, len, foregroundColour("text-brace-colour")); } else if (t instanceof Lexer.Strung) { highlightArea(pos, len, foregroundColour("text-string-colour")); } else if (t instanceof Lexer.Comment) { highlightArea(pos, len, foregroundColour("text-comment-colour")); } else if (t instanceof Lexer.Quote) { highlightArea(pos, len, foregroundColour("text-quote-colour")); } else if (t instanceof Lexer.Comma) { highlightArea(pos, len, foregroundColour("text-comma-colour")); } else if (t instanceof Lexer.Identifier) { highlightArea(pos, len, foregroundColour("text-identifier-colour")); } else if (t instanceof Lexer.Integer) { highlightArea(pos, len, foregroundColour("text-integer-colour")); } pos += len; } }
public Container CreateContentPane() { // Create the content-pane-to-be. JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setOpaque(true); // the log panel log = new JTextPane(); log.setEditable(false); log.setBackground(Color.BLACK); logPane = new JScrollPane(log); kit = new HTMLEditorKit(); doc = new HTMLDocument(); log.setEditorKit(kit); log.setDocument(doc); DefaultCaret c = (DefaultCaret) log.getCaret(); c.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); ClearLog(); // the preview panel previewPane = new DrawPanel(); previewPane.setPaperSize(paper_top, paper_bottom, paper_left, paper_right); // status bar statusBar = new StatusBar(); Font f = statusBar.getFont(); statusBar.setFont(f.deriveFont(Font.BOLD, 15)); Dimension d = statusBar.getMinimumSize(); d.setSize(d.getWidth(), d.getHeight() + 30); statusBar.setMinimumSize(d); // layout Splitter split = new Splitter(JSplitPane.VERTICAL_SPLIT); split.add(previewPane); split.add(logPane); split.setDividerSize(8); contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(split, BorderLayout.CENTER); // open the file if (recentFiles[0].length() > 0) { OpenFileOnDemand(recentFiles[0]); } // connect to the last port ListSerialPorts(); if (Arrays.asList(portsDetected).contains(recentPort)) { OpenPort(recentPort); } return contentPane; }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Windows Form * Designer. Otherwise, retrieving design might not work properly. Tip: If you must revise this * method, please backup this GUI file for JFrameBuilder to retrieve your design properly in * future, before revising this method. */ private void initializeComponent() { jTextPane1 = new JTextPane(); jButton1 = new JButton(); jButton2 = new JButton(); contentPane = (JPanel) this.getContentPane(); // // jTextPane1 // jTextPane1.setBackground(new Color(140, 152, 236)); jTextPane1.setForeground(new Color(255, 0, 0)); jTextPane1.setText( " \n NO DONUT FOR YOU\n SORRY FOR INCONVINIENCE FACED BY YOU\n SEVER IS DOWN FOR A TIME BEING\n PLEASE TRY AGAIN LATER"); jTextPane1.setEditable(false); // // jButton1 // jButton1.setText("Home"); jButton1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); // // jButton2 // jButton2.setText("Friends"); jButton2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButton2_actionPerformed(e); } }); // // contentPane // contentPane.setLayout(null); contentPane.setBackground(new Color(140, 152, 236)); addComponent(contentPane, jTextPane1, 76, 165, 451, 150); addComponent(contentPane, jButton1, 94, 36, 83, 39); addComponent(contentPane, jButton2, 184, 36, 83, 39); // // serverdown // this.setTitle("serverdown - extends JFrame"); this.setLocation(new Point(0, 0)); this.setSize(new Dimension(1024, 768)); }
public MyDialog() { super(); // "\u041e\u0448\u0438\u0431\u043a\u0430\u002e", true); setSize(200, 100); setLocation(350, 260); setBackground(new Color(0.77254903f, 0.015686275f, 0.12941177f, 1f)); setVisible(false); // <html><body text="red"><h3><i> </i></h3></body> label = new JTextPane(); label.setSize(196, 70); label.setLocation(2, 2); label.setBackground(new Color(0.77254903f, 0.015686275f, 0.12941177f, 1f)); label.setFont(new Font("Serif", Font.PLAIN, 16)); text = new String(""); MenuButton continuer = new MenuButton( "\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c", 2, 75, 96, 20, 7f); continuer.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { setVisible(false); } }); MenuButton more = new MenuButton( "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435", 102, 75, 96, 20, 7f); more.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { label.setText(text); } }); setLayout(null); add(label); add(continuer); add(more); }