Search in sources :

Example 1 with ViewerModel

use of net.sourceforge.pmd.util.viewer.model.ViewerModel in project pmd by pmd.

the class MainFrame method init.

private void init() {
    model = new ViewerModel();
    model.addViewerModelListener(this);
    sourcePanel = new SourceCodePanel(model);
    ASTPanel astPanel = new ASTPanel(model);
    xPathPanel = new XPathPanel(model);
    getContentPane().setLayout(new BorderLayout());
    JSplitPane editingPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sourcePanel, astPanel);
    editingPane.setResizeWeight(0.5d);
    JPanel interactionsPane = new JPanel(new BorderLayout());
    interactionsPane.add(xPathPanel, BorderLayout.SOUTH);
    interactionsPane.add(editingPane, BorderLayout.CENTER);
    getContentPane().add(interactionsPane, BorderLayout.CENTER);
    JButton compileBtn = new JButton(NLS.nls("MAIN.FRAME.COMPILE_BUTTON.TITLE"));
    compileBtn.setActionCommand(ActionCommands.COMPILE_ACTION);
    compileBtn.addActionListener(this);
    evalBtn = new JButton(NLS.nls("MAIN.FRAME.EVALUATE_BUTTON.TITLE"));
    evalBtn.setActionCommand(ActionCommands.EVALUATE_ACTION);
    evalBtn.addActionListener(this);
    evalBtn.setEnabled(false);
    statusLbl = new JLabel();
    statusLbl.setHorizontalAlignment(SwingConstants.RIGHT);
    JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
    btnPane.add(compileBtn);
    btnPane.add(evalBtn);
    btnPane.add(statusLbl);
    getContentPane().add(btnPane, BorderLayout.SOUTH);
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Language");
    ButtonGroup group = new ButtonGroup();
    jdk13MenuItem = new JRadioButtonMenuItem("JDK 1.3");
    jdk13MenuItem.setSelected(false);
    group.add(jdk13MenuItem);
    menu.add(jdk13MenuItem);
    jdk14MenuItem = new JRadioButtonMenuItem("JDK 1.4");
    jdk14MenuItem.setSelected(true);
    group.add(jdk14MenuItem);
    menu.add(jdk14MenuItem);
    jdk15MenuItem = new JRadioButtonMenuItem("JDK 1.5");
    jdk15MenuItem.setSelected(false);
    group.add(jdk15MenuItem);
    menu.add(jdk15MenuItem);
    jdk16MenuItem = new JRadioButtonMenuItem("JDK 1.6");
    jdk16MenuItem.setSelected(false);
    group.add(jdk16MenuItem);
    menu.add(jdk16MenuItem);
    jdk17MenuItem = new JRadioButtonMenuItem("JDK 1.7");
    jdk17MenuItem.setSelected(false);
    group.add(jdk17MenuItem);
    menu.add(jdk17MenuItem);
    // PLSQL
    plsqlMenuItem = new JRadioButtonMenuItem("PLSQL");
    plsqlMenuItem.setSelected(false);
    group.add(plsqlMenuItem);
    menu.add(plsqlMenuItem);
    menuBar.add(menu);
    setJMenuBar(menuBar);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    pack();
    setSize(800, 600);
    setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) ViewerModel(net.sourceforge.pmd.util.viewer.model.ViewerModel) JSplitPane(javax.swing.JSplitPane) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Aggregations

BorderLayout (java.awt.BorderLayout)1 FlowLayout (java.awt.FlowLayout)1 ButtonGroup (javax.swing.ButtonGroup)1 JButton (javax.swing.JButton)1 JLabel (javax.swing.JLabel)1 JMenu (javax.swing.JMenu)1 JMenuBar (javax.swing.JMenuBar)1 JPanel (javax.swing.JPanel)1 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)1 JSplitPane (javax.swing.JSplitPane)1 ViewerModel (net.sourceforge.pmd.util.viewer.model.ViewerModel)1