Java Code Examples for javax.swing.JToolBar#setRollover()

The following examples show how to use javax.swing.JToolBar#setRollover() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToolBarDemo2.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ToolBarDemo2() {
    super(new BorderLayout());

    // Create the toolbar.
    JToolBar toolBar = new JToolBar("Still draggable");
    addButtons(toolBar);
    toolBar.setFloatable(false);
    toolBar.setRollover(true);

    // Create the text area used for output. Request
    // enough space for 5 rows and 30 columns.
    textArea = new JTextArea(5, 30);
    textArea.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);

    // Lay out the main panel.
    setPreferredSize(new Dimension(450, 130));
    add(toolBar, BorderLayout.PAGE_START);
    add(scrollPane, BorderLayout.CENTER);
}
 
Example 2
Source File: HierarchyTopComponent.java    From netbeans with Apache License 2.0 6 votes vote down vote up
MainToolBar(@NonNull final Pair<JComponent,GridBagConstraints>... components) {
    super(BoxLayout.X_AXIS);
    setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 5));
    final JToolBar toolbar = new NoBorderToolBar(JToolBar.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    toolbar.setBorder(BorderFactory.createEmptyBorder());
    toolbar.setOpaque(false);
    toolbar.setFocusable(false);
    toolbar.setLayout(new GridBagLayout());
    for (Pair<JComponent,GridBagConstraints> p : components) {
        toolbar.add(p.first(),p.second());
    }
    add (toolbar);
}
 
Example 3
Source File: ActionsClass.java    From RobotBuilder with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public JToolBar getToolBar() {
    JToolBar bar = new JToolBar();
    bar.setFloatable(false);
    bar.setRollover(true);

    bar.add(newAction);
    bar.add(saveAction);
    bar.add(openAction);

    JButton undoButton = new JButton(undoAction);
    JButton redoButton = new JButton(redoAction);

    bar.add(undoButton);
    bar.add(redoButton);
    bar.add(verifyAction);
    exporters.stream()
            .filter(ExporterAction::isOnToolbar)
            .forEach(bar::add);
    bar.add(gettingStartedAction);
    return bar;
}
 
Example 4
Source File: YearChooser.java    From javamoney-examples with Apache License 2.0 6 votes vote down vote up
private
JToolBar
createButton(String command, Icon icon, String tip)
{
  JToolBar toolBar = new JToolBar();
  Link link = new Link();

  // Build link.
  buildButton(link, icon, new ActionHandler(), command, tip);

  // Build tool bar.
  toolBar.add(link);
  toolBar.setBorderPainted(false);
  toolBar.setFloatable(false);
  toolBar.setRollover(true);

  return toolBar;
}
 
Example 5
Source File: ViewComponent.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
    setLayout (new BorderLayout ());
    contentComponent = new javax.swing.JPanel(new BorderLayout ());
    add (contentComponent, BorderLayout.CENTER);  //NOI18N
    JToolBar toolBar = new JToolBar(JToolBar.VERTICAL);
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    toolBar.setBorderPainted(true);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
        toolBar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
    }
    toolBar.setBorder(javax.swing.BorderFactory.createCompoundBorder(
            javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1,
            javax.swing.UIManager.getDefaults().getColor("Separator.background")),
            javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1,
            javax.swing.UIManager.getDefaults().getColor("Separator.foreground"))));
    add(toolBar, BorderLayout.WEST);
    JComponent buttonsPane = toolBar;
    viewModelListener = new ViewModelListener (
        name,
        contentComponent,
        buttonsPane,
        propertiesHelpID,
        ImageUtilities.loadImage(icon)
    );
}
 
Example 6
Source File: DataViewUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JPanel initializeMainPanel(boolean nbOutputComponent) {

        JPanel panel = new JPanel();
        panel.setBorder(BorderFactory.createEtchedBorder());
        panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));

        ActionListener outputListener = createOutputListener();
        initVerticalToolbar(outputListener);

        JToolBar toolbarWest = new JToolBar();
        toolbarWest.setFloatable(false);
        toolbarWest.setRollover(true);
        initToolbarWest(toolbarWest, outputListener, nbOutputComponent);
        
        JToolBar toolbarEast = new JToolBar();
        toolbarEast.setFloatable(false);
        toolbarEast.setRollover(true);
        initToolbarEast(toolbarEast);
        toolbarEast.setMinimumSize(toolbarWest.getPreferredSize());
        toolbarEast.setSize(toolbarWest.getPreferredSize());
        toolbarEast.setMaximumSize(toolbarWest.getPreferredSize());

        panel.add(toolbarWest);
        panel.add(Box.createHorizontalGlue());
        panel.add(toolbarEast);

        return panel;
    }
 
Example 7
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static JToolBar createToolBar(final boolean horizontal) {
    JToolBar tb = new JToolBar(horizontal ? JToolBar.HORIZONTAL : JToolBar.VERTICAL) {
        public void layout() {
            super.layout();
            if (horizontal) {
                if (BUTTON_HEIGHT == -1)
                    BUTTON_HEIGHT = getButtonHeight();
                Insets i = getInsets();
                int height = getHeight() - i.top - i.bottom;
                for (Component comp : getComponents()) {
                    if (comp.isVisible() && (comp instanceof JButton || comp instanceof JToggleButton)) {
                        Rectangle b = comp.getBounds();
                        b.height = BUTTON_HEIGHT;
                        b.y = i.top + (height - b.height) / 2;
                        comp.setBounds(b);
                    }
                }
            }
        }
    };
    if (UISupport.isNimbusLookAndFeel())
        tb.setLayout(new BoxLayout(tb, horizontal ? BoxLayout.X_AXIS :
                                                    BoxLayout.Y_AXIS));
    tb.setBorderPainted(false);
    tb.setFloatable(false);
    tb.setRollover(true);
    tb.setOpaque(false);
    return tb;
}
 
Example 8
Source File: Help.java    From FancyBing with GNU General Public License v3.0 5 votes vote down vote up
private JComponent createButtons()
{
    JToolBar toolBar = new JToolBar();
    toolBar.add(createToolBarButton("go-home", "contents", "TT_HELP_TOC"));
    m_buttonBack = createToolBarButton("go-previous", "back",
                                       "TT_HELP_BACK");
    toolBar.add(m_buttonBack);
    m_buttonForward = createToolBarButton("go-next", "forward",
                                          "TT_HELP_FORWARD");
    toolBar.add(m_buttonForward);
    if (! Platform.isMac())
        toolBar.setRollover(true);
    toolBar.setFloatable(false);
    return toolBar;
}
 
Example 9
Source File: WatchAnnotationProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static JToolBar createActionsToolbar() {
    JToolBar jt = new JToolBar(JToolBar.HORIZONTAL);
    jt.setBorder(new EmptyBorder(0, 0, 0, 0));
    jt.setFloatable(false);
    jt.setRollover(false);
    return jt;
}
 
Example 10
Source File: CSVColumnPanel.java    From javamoney-examples with Apache License 2.0 5 votes vote down vote up
private
Panel
createButtonPanel()
{
  ActionHandler handler = new ActionHandler();
  JToolBar toolBar = new JToolBar();
  Panel panel = new Panel();
  Dimension separator = new Dimension(15, 10);

  // Build tool bar.
  toolBar.setBorderPainted(false);
  toolBar.setFloatable(false);
  toolBar.setRollover(true);

  toolBar.add(createButton(ARROW_UP.getIcon(), ACTION_UP, handler,
      getProperty("up_tip")));

  toolBar.addSeparator(separator);

  toolBar.add(createButton(ARROW_DOWN.getIcon(), ACTION_DOWN, handler,
      getProperty("down_tip")));

  // Build panel.
  panel.add(toolBar, 0, 0, 1, 1, 100, 100);

  return panel;
}
 
Example 11
Source File: FiltersManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Called only from AWT */
private void initPanel () {
    setBorder(new EmptyBorder(1, 2, 3, 5));

    // configure toolbar
    JToolBar toolbar = new JToolBar(JToolBar.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    // create toggle buttons
    int filterCount = filtersDesc.getFilterCount();
    toggles = new ArrayList<JToggleButton>(filterCount);
    JToggleButton toggleButton = null;
    
    Map<String,Boolean> fStates = new HashMap<String, Boolean>(filterCount * 2);

    for (int i = 0; i < filterCount; i++) {
        toggleButton = createToggle(fStates, i);
        toggles.add(toggleButton);
    }
    
    // add toggle buttons
    JToggleButton curToggle;
    Dimension space = new Dimension(3, 0);
    for (int i = 0; i < toggles.size(); i++) {
        curToggle = toggles.get(i);
        curToggle.addActionListener(this);
        toolbar.add(curToggle);
        if (i != toggles.size() - 1) {
            toolbar.addSeparator(space);
        }
    }
    
    add(toolbar);
    
    // initialize member states map
    synchronized (STATES_LOCK) {
        filterStates = fStates;
    }
}
 
Example 12
Source File: MetalSlidingButtonUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void installDefaults (AbstractButton b) {
       super.installDefaults(b);
if(!defaults_initialized) {
           hiddenToggle = new JToggleButton();
           hiddenToggle.setText("");
           JToolBar bar = new JToolBar();
           bar.setRollover(true);
           bar.add(hiddenToggle);
    defaults_initialized = true;
}
   }
 
Example 13
Source File: GtkSlidingButtonUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void installDefaults (AbstractButton b) {
       super.installDefaults(b);
if(!defaults_initialized) {
           hiddenToggle = new JToggleButton();
           hiddenToggle.setText("");
           JToolBar bar = new JToolBar();
           bar.setRollover(true);
           bar.add(hiddenToggle);
    defaults_initialized = true;
}
   }
 
Example 14
Source File: Main_BottomToolbar.java    From Hotel-Properties-Management-System with GNU General Public License v2.0 4 votes vote down vote up
public Main_BottomToolbar() {

        toolBar = new JToolBar();
        toolBar.setAlignmentX(Component.LEFT_ALIGNMENT);
        toolBar.setAlignmentY(Component.BOTTOM_ALIGNMENT);
        toolBar.setPreferredSize(new Dimension(1200, 25));
        toolBar.setMinimumSize(new Dimension(800, 25));
        toolBar.setAutoscrolls(true);
        toolBar.setFloatable(false);
        toolBar.setRollover(true);

        userIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_user.png")));
        toolBar.add(userIconLabel);

        //initialize weather api for use.
        liveWeather = new GetLiveWeather();
        
        userLabel = new JLabel();
        userLabel.setMaximumSize(new Dimension(160, 19));
        userLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        userLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        userLabel.setHorizontalAlignment(SwingConstants.LEFT);
        toolBar.add(userLabel);
        toolBar.addSeparator();

        dateIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_calendar.png")));
        toolBar.add(dateIconLabel);

        dateLabel = new JLabel("");
        dateLabel.setMaximumSize(new Dimension(160, 19));
        dateLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        dateLabel.setHorizontalAlignment(SwingConstants.LEFT);
        dateLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(dateLabel);
        toolBar.addSeparator();

        currencyUsdIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency.png")));
        toolBar.add(currencyUsdIcon);

        currencyUsdLabel = new JLabel("");
        currencyUsdLabel.setMaximumSize(new Dimension(160, 19));
        currencyUsdLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyUsdLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyUsdLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyUsdLabel);
        toolBar.addSeparator();

        currencyEuroIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_euro.png")));
        toolBar.add(currencyEuroIcon);

        currencyEuroLabel = new JLabel("");
        currencyEuroLabel.setMaximumSize(new Dimension(160, 19));
        currencyEuroLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyEuroLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyEuroLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyEuroLabel);
        toolBar.addSeparator();

        currencyPoundIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_pound.png")));
        toolBar.add(currencyPoundIcon);

        currencyPoundLabel = new JLabel("");
        currencyPoundLabel.setMaximumSize(new Dimension(160, 19));
        currencyPoundLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyPoundLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyPoundLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyPoundLabel);
        toolBar.addSeparator();

        hotelIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/login_hotel.png")));
        toolBar.add(hotelIconLabel);

        hotelNameLabel = new JLabel("");
        hotelNameLabel.setMaximumSize(new Dimension(160, 19));
        hotelNameLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        hotelNameLabel.setHorizontalAlignment(SwingConstants.LEFT);
        hotelNameLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(hotelNameLabel);
        toolBar.addSeparator();

        checkBox = new JCheckBox("");
        checkBox.setToolTipText("Enable local weather");
        checkBox.addItemListener(showWeather());
        toolBar.add(checkBox);

        weatherIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/toolbar_weather.png")));
        toolBar.add(weatherIconLabel);

        weatherLabel = new JLabel("");
        weatherLabel.setPreferredSize(new Dimension(160, 19));
        weatherLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        weatherLabel.setHorizontalAlignment(SwingConstants.LEFT);
        weatherLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        weatherLabel.setEnabled(false);
        toolBar.add(weatherLabel);

    }
 
Example 15
Source File: MainFrame.java    From jmkvpropedit with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public MainFrame() {
	showConfigName(null);
	setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	addWindowListener(new MainFrameListener());
	setGlassPane(new GlassPane(this));
	_fileChooser.setFileFilter(new FileChooserFilter(
			Messages.getString("MainFrame.config.files"),
			new String[] {".xml", ".cfg"}));

	_toolBar = new JToolBar();
	_toolBar.setFloatable(false);
	_toolBar.setRollover(true);
	addButton("images/new.png",	Messages.getString("MainFrame.new.config"),
			new NewActionListener());
	addButton("images/open.png", Messages.getString("MainFrame.open.config"),
			new OpenActionListener());
	addButton("images/save.png", Messages.getString("MainFrame.save.config"),
			new SaveActionListener());
	_toolBar.addSeparator();
	addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"),
			new BuildActionListener());
	_runButton = addButton("images/run.png",
			Messages.getString("MainFrame.test.wrapper"),
			new RunActionListener());
	setRunEnabled(false);
	_toolBar.addSeparator();
	addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"),
			new AboutActionListener());

	_configForm = new ConfigFormImpl();
	getContentPane().setLayout(new BorderLayout());
	getContentPane().add(_toolBar, BorderLayout.NORTH);
	getContentPane().add(_configForm, BorderLayout.CENTER);
	pack();
	Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
	Dimension fr = getSize();
	fr.width += 25;
	fr.height += 100;
	setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2,
			fr.width, fr.height);
	setVisible(true);
}
 
Example 16
Source File: MainFrame.java    From PyramidShader with GNU General Public License v3.0 4 votes vote down vote up
public MainFrame() {
	showConfigName(null);
	setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	addWindowListener(new MainFrameListener());
	setGlassPane(new GlassPane(this));
	_fileChooser.setFileFilter(new FileChooserFilter(
			Messages.getString("MainFrame.config.files"),
			new String[] {".xml", ".cfg"}));

	_toolBar = new JToolBar();
	_toolBar.setFloatable(false);
	_toolBar.setRollover(true);
	addButton("images/new.png",	Messages.getString("MainFrame.new.config"),
			new NewActionListener());
	addButton("images/open.png", Messages.getString("MainFrame.open.config"),
			new OpenActionListener());
	addButton("images/save.png", Messages.getString("MainFrame.save.config"),
			new SaveActionListener());
	_toolBar.addSeparator();
	addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"),
			new BuildActionListener());
	_runButton = addButton("images/run.png",
			Messages.getString("MainFrame.test.wrapper"),
			new RunActionListener());
	setRunEnabled(false);
	_toolBar.addSeparator();
	addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"),
			new AboutActionListener());

	_configForm = new ConfigFormImpl();
	getContentPane().setLayout(new BorderLayout());
	getContentPane().add(_toolBar, BorderLayout.NORTH);
	getContentPane().add(_configForm, BorderLayout.CENTER);
	pack();
	Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
	Dimension fr = getSize();
	fr.width += 25;
	fr.height += 100;
	setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2,
			fr.width, fr.height);
	setVisible(true);
}
 
Example 17
Source File: RoutingTab.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public ResultToolbar() {
	jToolBar = new JToolBar();
	GroupLayout layout = new GroupLayout(jToolBar);
	jToolBar.setLayout(layout);
	layout.setAutoCreateGaps(true);
	layout.setAutoCreateContainerGaps(false);

	jToolBar.setFloatable(false);
	jToolBar.setRollover(true);
	
	jName = new JLabel();
	plain = jName.getFont();
	italic = new Font(plain.getName(), Font.ITALIC, plain.getSize());

	jEveUiSetRoute = new JButton(TabsRouting.get().resultUiWaypoints(), Images.MISC_EVE.getIcon());
	jEveUiSetRoute.setActionCommand(RoutingAction.EVE_UI.name());
	jEveUiSetRoute.addActionListener(listener);
	jEveUiSetRoute.setEnabled(false);

	jEditRoute = new JButton(TabsRouting.get().resultEdit(), Images.EDIT_EDIT.getIcon());
	jEditRoute.setHorizontalAlignment(JButton.LEFT);
	jEditRoute.setActionCommand(RoutingAction.ROUTE_EDIT.name());
	jEditRoute.addActionListener(listener);
	jEditRoute.setEnabled(false);

	jSaveRoute = new JButton(TabsRouting.get().resultSave(), Images.FILTER_SAVE.getIcon());
	jSaveRoute.setHorizontalAlignment(JButton.LEFT);
	jSaveRoute.setActionCommand(RoutingAction.ROUTE_SAVE.name());
	jSaveRoute.addActionListener(listener);
	jSaveRoute.setEnabled(false);

	jLoadRoute = new JDropDownButton(TabsRouting.get().resultLoad(), Images.FILTER_LOAD.getIcon());
	jLoadRoute.setHorizontalAlignment(JButton.LEFT);

	layout.setHorizontalGroup(
		layout.createSequentialGroup()
			.addContainerGap()
			.addComponent(jName, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Integer.MAX_VALUE)
			.addGap(0, 0, Integer.MAX_VALUE)
			.addComponent(jEveUiSetRoute)
			.addComponent(jEditRoute, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, 100)
			.addComponent(jSaveRoute, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, 100)
			.addComponent(jLoadRoute, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, 100)
			.addContainerGap()
	);
	layout.setVerticalGroup(
		layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
			.addComponent(jName)
			.addComponent(jEveUiSetRoute)
			.addComponent(jEditRoute)
			.addComponent(jSaveRoute)
			.addComponent(jLoadRoute)
	);

	jManageRoutes = new JMenuItem(TabsRouting.get().resultManage(), Images.DIALOG_SETTINGS.getIcon());
	jManageRoutes.setActionCommand(RoutingAction.ROUTE_MANAGE.name());
	jManageRoutes.addActionListener(listener);
}
 
Example 18
Source File: LogPanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
public LogPanel() {
    if (tailer == null) {

        setPreferredSize(new Dimension(400, 300));
        setLayout(new BorderLayout());

        textArea = new JTextArea();
        textArea.setEditable(false);
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        JScrollPane scrollPanel = new JScrollPane(textArea);

        linesTextField = new JTextField();
        linesTextField.setPreferredSize(dim);
        linesTextField.setMinimumSize(dim);
        linesTextField.setMaximumSize(dim);
        linesTextField.setText(String.valueOf(LINES));

        JToolBar toolBar = new JToolBar();
        toolBar.setRollover(true);
        toolBar.add(new ClearLogAction(textArea));
        toolBar.add(new ReloadLogAction(textArea, this));

        JPanel topPanel = new JPanel();
        topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
        topPanel.add(toolBar);
        topPanel.add(Box.createHorizontalStrut(5));
        topPanel.add(new JLabel(I18NSupport.getString("logpanel.last.lines")));
        topPanel.add(Box.createHorizontalStrut(5));
        topPanel.add(linesTextField);
        topPanel.add(Box.createHorizontalGlue());

        add(topPanel, BorderLayout.NORTH);
        add(scrollPanel, BorderLayout.CENTER);

        final File log = new File(LOG);
        if (!log.exists()) {
            try {
                new File(LOG_DIR).mkdirs();
                boolean created = log.createNewFile();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        // read existing text in log
        Thread t = new Thread(new Runnable() {
            public void run() {
                Cursor hourGlassCursor = new Cursor(Cursor.WAIT_CURSOR);
                setCursor(hourGlassCursor);

                //@todo
                //reload(log, textArea);

                tailer = new LogFileTailer(log, 1000, false);
                tailer.addLogFileTailerListener(LogPanel.this);
                tailer.setPriority(Thread.MIN_PRIORITY);

                // very consuming !!!
                //tailer.start();

                Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
                setCursor(normalCursor);
            }
        }, "NEXT : " + getClass().getSimpleName());
        t.start();

    }
}
 
Example 19
Source File: WebSocketFuzzResultsContentPanel.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public WebSocketFuzzResultsContentPanel() {
    super(new BorderLayout());

    toolbar = new JToolBar();
    toolbar.setFloatable(false);
    toolbar.setRollover(true);

    messageCountLabel =
            new JLabel(
                    Constant.messages.getString(
                            "websocket.fuzzer.results.toolbar.messagesSent"));
    messageCountValueLabel = new JLabel("0");

    errorCountLabel =
            new JLabel(Constant.messages.getString("websocket.fuzzer.results.toolbar.errors"));
    errorCountValueLabel = new JLabel("0");

    toolbar.add(Box.createHorizontalStrut(4));
    toolbar.add(messageCountLabel);
    toolbar.add(Box.createHorizontalStrut(4));
    toolbar.add(messageCountValueLabel);
    toolbar.add(Box.createHorizontalStrut(32));

    toolbar.add(errorCountLabel);
    toolbar.add(Box.createHorizontalStrut(4));
    toolbar.add(errorCountValueLabel);

    mainPanel = new JPanel(new BorderLayout());

    fuzzResultTable = new WebSocketFuzzMessagesView(EMPTY_RESULTS_MODEL);
    fuzzResultTable.setDisplayPanel(
            View.getSingleton().getRequestPanel(), View.getSingleton().getResponsePanel());

    fuzzResultTableScrollPane = new JScrollPane();
    fuzzResultTableScrollPane.setViewportView(fuzzResultTable.getViewComponent());
    fuzzResultTableScrollPane
            .getVerticalScrollBar()
            .addAdjustmentListener(new StickyScrollbarAdjustmentListener());

    mainPanel.add(fuzzResultTableScrollPane);

    add(toolbar, BorderLayout.PAGE_START);
    add(mainPanel, BorderLayout.CENTER);
}
 
Example 20
Source File: MainFrame.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
public MainFrame() {
	showConfigName(null);
	setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	addWindowListener(new MainFrameListener());
	setGlassPane(new GlassPane(this));
	_fileChooser.setFileFilter(new FileChooserFilter(
			Messages.getString("MainFrame.config.files"),
			new String[] {".xml", ".cfg"}));

	_toolBar = new JToolBar();
	_toolBar.setFloatable(false);
	_toolBar.setRollover(true);
	addButton("images/new.png",	Messages.getString("MainFrame.new.config"),
			new NewActionListener());
	addButton("images/open.png", Messages.getString("MainFrame.open.config"),
			new OpenActionListener());
	addButton("images/save.png", Messages.getString("MainFrame.save.config"),
			new SaveActionListener());
	_toolBar.addSeparator();
	addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"),
			new BuildActionListener());
	_runButton = addButton("images/run.png",
			Messages.getString("MainFrame.test.wrapper"),
			new RunActionListener());
	setRunEnabled(false);
	_toolBar.addSeparator();
	addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"),
			new AboutActionListener());

	_configForm = new ConfigFormImpl();
	getContentPane().setLayout(new BorderLayout());
	getContentPane().add(_toolBar, BorderLayout.NORTH);
	getContentPane().add(_configForm, BorderLayout.CENTER);
	pack();
	Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
	Dimension fr = getSize();
	fr.width += 25;
	fr.height += 100;
	setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2,
			fr.width, fr.height);
	setVisible(true);
}