Java Code Examples for javax.swing.JScrollPane#VERTICAL_SCROLLBAR_ALWAYS

The following examples show how to use javax.swing.JScrollPane#VERTICAL_SCROLLBAR_ALWAYS . 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: AttachDialog.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private static void showDetails(RunningVM vm) {
    HTMLTextArea area = new HTMLTextArea();
    JScrollPane areaScroll = new JScrollPane(area, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                                   JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    areaScroll.setBorder(BorderFactory.createEmptyBorder());
    areaScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    areaScroll.setPreferredSize(new Dimension(500, 260));
    configureScrollBar(areaScroll.getVerticalScrollBar());
    configureScrollBar(areaScroll.getHorizontalScrollBar());
    
    area.setText(getDetails(vm));
    area.setCaretPosition(0);
    
    HelpCtx helpCtx = new HelpCtx("ProcessDetails.HelpCtx"); //NOI18N
    JButton close = new JButton(Bundle.AttachDialog_BtnClose());
    close.setDefaultCapable(true);
    DialogDescriptor dd = new DialogDescriptor(areaScroll, Bundle.AttachDialog_DetailsCaption(getProcessName(vm.getMainClass())),
                          true, new Object[] { close }, close, DialogDescriptor.DEFAULT_ALIGN, helpCtx, null);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.pack();
    d.setVisible(true);
}
 
Example 2
Source File: HealthTab.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
private JScrollPane addTable(JTable table, HealthTableModel healthTableModel, JPanel centerPanel, BitArrayLayout rt) {

		table.setAutoCreateRowSorter(true);
//		listSelectionModel = table.getSelectionModel();
 //       listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
 //       table.setSelectionModel(listSelectionModel);
		table.addMouseListener(this);
		
		scrollPane = new JScrollPane (table, 
				   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		table.setFillsViewportHeight(true);
		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		//table.setMinimumSize(new Dimension(6200, 6000));

		centerPanel.add(scrollPane);
		return scrollPane;
	}
 
Example 3
Source File: PropertiesTable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void init(JLabel label, String[] columns) {
    tableModel = new PropertiesTableModel(columns);
    tableModel.addTableModelListener(this);
    table = new JTable(tableModel);
    table.getTableHeader().setReorderingAllowed(false);
    table.setDefaultRenderer(String.class, new PropertiesTableCellRenderer());
    //table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
    table.setRowHeight(table.getRowHeight());
    table.addAncestorListener(this);
    component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    component.setPreferredSize(new Dimension(340, 150));
    table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PropertiesTable.class, "ACSD_PropertiesTable")); // NOI18N        
    table.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PropertiesTable.class, "ACSN_PropertiesTable")); // NOI18N        
    label.setLabelFor(table);
    setColumns(columns);
}
 
Example 4
Source File: PropertiesTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void init(JLabel label, String[] columns, TableSorter sorter) {
    tableModel = new PropertiesTableModel(columns);
    tableModel.addTableModelListener(this);
    if(sorter == null) {
        sorter = new TableSorter(tableModel);
    } 
    this.sorter = sorter;   
    table = new SortedTable(this.sorter);
    table.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PropertiesTable.class, "tableProperties.AccessibleContext.accessibleName"));
    table.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesTable.class, "tableProperties.AccessibleContext.accessibleDescription"));
    table.getTableHeader().setReorderingAllowed(false);
    TableCellRenderer cellRenderer = new PropertiesTableCellRenderer();
    table.setDefaultRenderer(String.class, cellRenderer);
    table.setRowHeight(Math.max(
            table.getRowHeight(),
            cellRenderer.getTableCellRendererComponent(table, "abc", true, true, 0, 0)//NOI18N
                        .getPreferredSize().height + 2));
    //table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
    table.getTableHeader().setReorderingAllowed(true);
    table.setRowHeight(table.getRowHeight());
    table.addAncestorListener(this);
    component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    component.setPreferredSize(new Dimension(340, 150));
    table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PropertiesTable.class, "ACSD_PropertiesTable")); // NOI18N        
    label.setLabelFor(table);
    setColumns(columns);
}
 
Example 5
Source File: MetalworksDocumentFrame.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 6
Source File: LogBox.java    From ChatGameFontificator with The Unlicense 5 votes vote down vote up
public LogBox()
{
    super(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    this.authCode = null;

    output = new JTextArea();
    output.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    output.setWrapStyleWord(true);
    output.setLineWrap(true);
    output.setEditable(false);
    output.setBackground(getBackground());

    super.setViewportView(output);
}
 
Example 7
Source File: MetalworksDocumentFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 8
Source File: MetalworksDocumentFrame.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 9
Source File: MetalworksDocumentFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 10
Source File: MetalworksDocumentFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 11
Source File: AddOrEditPromotionDialog.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public void init() {
	this.okButton.setText("确定");
	this.okButton.setActionCommand(ActionName.OK.toString());
	this.okButton.addActionListener(this);
	this.cancelButton.setText("取消");
	this.cancelButton.setActionCommand(ActionName.CANCEL.toString());
	this.cancelButton.addActionListener(this);
	this.tipFields.setColumns(20);
	this.tipFields.setRows(20);
	
	if ( this.pojo != null ) {
		this.idField.setValue(this.pojo.getId());
		this.channelField.setText(this.pojo.getChannel());
		this.startField.setDate(new Date(this.pojo.getStartMillis()));
		this.endField.setDate(new Date(this.pojo.getEndMillis()));
		this.tipFields.setText(this.pojo.getMessage());
	}
	
	this.setLayout(new MigLayout("wrap 4"));
	this.setSize(400, 300);
	this.add(new JLabel("ID:"));
	this.add(idField, "width 10%, sg fd");
	this.add(channelLabel, "sg lbl");
	this.add(channelField, "sg fd");
	this.add(startLabel, "");
	this.add(startField, "sg fd");
	this.add(endLabel, "");
	this.add(endField, "sg fd");
	this.add(new JLabel("公告信息:"), "sg lbl");
	JScrollPane pane = new JScrollPane(tipFields, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 
			JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	this.add(pane, "span, growx");
	this.add(okButton, "span, split 2, align center");
	this.add(cancelButton);
	
	this.setResizable(true);
	Point c = WindowUtils.getPointForCentering(this);
	this.setLocation(c);
	this.setModal(true);
}
 
Example 12
Source File: PlanDetailPanel.java    From incubator-iotdb with Apache License 2.0 5 votes vote down vote up
PlanDetailPanel() {
  super(null, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  setBorder(BorderFactory.createTitledBorder("Plan detail"));

  nameField.setBorder(BorderFactory.createTitledBorder("Plan name"));
  patternField.setBorder(BorderFactory.createTitledBorder("Content Pattern"));
  measurementsField.setBorder(BorderFactory.createTitledBorder("Measurement positions"));
  legendsField.setBorder(BorderFactory.createTitledBorder("Legends"));
  tagField.setBorder(BorderFactory.createTitledBorder("Tag positions"));
  levelField.setBorder(BorderFactory.createTitledBorder("Log level"));
  threadNameField.setBorder(BorderFactory.createTitledBorder("Allowed thread names"));
  classNameField.setBorder(BorderFactory.createTitledBorder("Allowed class names"));
  lineNumField.setBorder(BorderFactory.createTitledBorder("Allowed line numbers"));
  datePatternField.setBorder(BorderFactory.createTitledBorder("Date pattern"));
  startDateField.setBorder(BorderFactory.createTitledBorder("Start date"));
  endDateField.setBorder(BorderFactory.createTitledBorder("End date"));

  Box box = Box.createVerticalBox();

  box.add(nameField);
  box.add(patternField);
  box.add(measurementsField);
  box.add(legendsField);
  box.add(tagField);
  box.add(levelField);
  box.add(threadNameField);
  box.add(classNameField);
  box.add(lineNumField);
  box.add(datePatternField);
  box.add(startDateField);
  box.add(endDateField);

  setViewportView(box);
}
 
Example 13
Source File: MetalworksDocumentFrame.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 14
Source File: PluginTester.java    From marvinproject with GNU Lesser General Public License v3.0 4 votes vote down vote up
public PluginTester(){
		super("Plug-in Tester");
		
		// GUI
		ButtonHandler l_buttonHandler = new ButtonHandler();
		buttonLoadPlugin = new JButton("Load Plugin");
		buttonSaveImage = new JButton("Save Image");
		buttonReset = new JButton("Reset");	
		buttonConvertToBinary = new JButton("To Binary");
		buttonGenerateJarFiles = new JButton("Generate Jar Files");
		buttonBenchmark = new JButton("Benchmark");
		
		buttonLoadPlugin.addActionListener(l_buttonHandler);
		buttonSaveImage.addActionListener(l_buttonHandler);
		buttonReset.addActionListener(l_buttonHandler);
		buttonConvertToBinary.addActionListener(l_buttonHandler);
		buttonGenerateJarFiles.addActionListener(l_buttonHandler);
		buttonBenchmark.addActionListener(l_buttonHandler);
		
		imagePanel = new MarvinImagePanel();
		JScrollPane scrollPane = new JScrollPane(imagePanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		
		
		JPanel panelBottom = new JPanel();
		panelBottom.add(buttonLoadPlugin);
		panelBottom.add(buttonSaveImage);
		panelBottom.add(buttonReset);
		panelBottom.add(buttonConvertToBinary);
		panelBottom.add(buttonGenerateJarFiles);		
		panelBottom.add(buttonBenchmark);
		
		// Container
		Container l_con = getContentPane();
		l_con.setLayout(new BorderLayout());
		
		l_con.add(scrollPane, BorderLayout.CENTER);
		l_con.add(panelBottom, BorderLayout.SOUTH);
		
		
		// Load image
		originalImage = MarvinImageIO.loadImage(INITIAL_IMAGE);
		
//		originalImage = new MarvinImage(500, 500, MarvinImage.COLOR_MODEL_RGB);
//		originalImage.fillRect(0, 0, 500, 500, Color.white);
//		originalImage.fillRect(100, 100, 300, 300, Color.red);
//		originalImage.update();
		
		//originalImage = new MarvinImage(50,50);
		newImage = originalImage.clone();
		imagePanel.setImage(newImage);
		
		
		
		
		
		// Benchmark
		benchmark = new Benchmark(); 
		
		int width;
		if(originalImage.getWidth() < 460){
			width = 460;
		}
		else{
			width = originalImage.getWidth();
		}
		setSize(700,500+70);
		
		setVisible(true);
	}
 
Example 15
Source File: DetailsPanel.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private void initComponents() {        
    table = new DetailsTable();
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JViewport viewport = new Viewport(table);

    final JScrollPane tableScroll = new JScrollPane(
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScroll.setViewport(viewport);
    tableScroll.setBorder(BorderFactory.createEmptyBorder());
    tableScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel());
    
    scrollBar = new ScrollBar(JScrollBar.VERTICAL) {
        public int getUnitIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
        }
        public int getBlockIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
        }
        public void setValues(int newValue, int newExtent, int newMin, int newMax) {
            setEnabled(newExtent < newMax);
            if (isEnabled() && !isSelectionChanging() && isTrackingEnd())
                newValue = newMax - newExtent;
            super.setValues(newValue, newExtent, newMin, newMax);
        }
    };
    tableScroll.setVerticalScrollBar(scrollBar);
    dataContainer = tableScroll;

    JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER);
    noDataLabel.setEnabled(false);
    noDataContainer = new JPanel(new BorderLayout());
    noDataContainer.setOpaque(false);
    noDataContainer.add(noDataLabel, BorderLayout.CENTER);

    setOpaque(false);
    setLayout(new BorderLayout());
    add(noDataContainer, BorderLayout.CENTER);
}
 
Example 16
Source File: HelpOutputDialog.java    From dualsub with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void initComponents() {
	// Features
	final int marginLeft = 23;
	this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	this.setResizable(false);
	getContentPane().setLayout(new BorderLayout());
	JPanel panel = new JPanel();
	panel.setLayout(null);
	panel.setPreferredSize(new Dimension(getWidth(), getHeight() + 100));
	panel.setBackground(parent.getBackground());
	JScrollPane scroll = new JScrollPane(panel,
			JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
			JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	getContentPane().add(scroll);

	// Title
	final String title = I18N.getHtmlText("PanelOutput.border.text");
	setTitle(I18N.getText("Window.name.text"));
	JLabel lblTitle = new JLabel(title);
	lblTitle.setFont(new Font("Lucida", Font.BOLD, 20));
	lblTitle.setBounds(marginLeft, 21, 535, 25);
	panel.add(lblTitle);

	// Content
	JLabel lblContent01 = new JLabel(
			I18N.getHtmlText("HelpOutputDialog.help.01"));
	lblContent01.setBounds(marginLeft, 50, 535, 230);
	panel.add(lblContent01);

	JLabel lblContent02 = new JLabel(I18N.getHtmlText(
			"HelpOutputDialog.help.02", Html.MONOSPACE));
	lblContent02.setBounds(marginLeft, 280, 535, 120);
	panel.add(lblContent02);

	JLabel lblContent03 = new JLabel(
			I18N.getHtmlText("HelpOutputDialog.help.03"));
	lblContent03.setBounds(marginLeft, 400, 535, 40);
	panel.add(lblContent03);

	JLabel lblContent04 = new JLabel(I18N.getHtmlText(
			"HelpOutputDialog.help.04", Html.MONOSPACE));
	lblContent04.setBounds(marginLeft, 440, 535, 70);
	panel.add(lblContent04);

	// Borders (for debug purposes)
	if (log.isTraceEnabled()) {
		Border border = BorderFactory.createLineBorder(Color.black);
		lblTitle.setBorder(border);
		lblContent01.setBorder(border);
		lblContent02.setBorder(border);
		lblContent03.setBorder(border);
		lblContent04.setBorder(border);
		panel.setBorder(border);
	}
}
 
Example 17
Source File: GtpShell.java    From FancyBing with GNU General Public License v3.0 4 votes vote down vote up
public GtpShell(Frame owner, Listener listener,
                MessageDialogs messageDialogs)
{
    super(owner, i18n("TIT_SHELL"));
    m_messageDialogs = messageDialogs;
    m_listener = listener;
    Preferences prefs = Preferences.userNodeForPackage(getClass());
    m_historyMin = prefs.getInt("history-min", 2000);
    m_historyMax = prefs.getInt("history-max", 3000);
    JPanel panel = new JPanel(new BorderLayout());
    getContentPane().add(panel, BorderLayout.CENTER);
    m_gtpShellText = new GtpShellText(m_historyMin, m_historyMax, false);
    CaretListener caretListener = new CaretListener()
        {
            public void caretUpdate(CaretEvent event)
            {
                if (m_listener == null)
                    return;
                // Call the callback only if the selected text has changed.
                // This avoids that the callback is called multiple times
                // if the caret position changes, but the text selection
                // was null before and after the change (see also bug
                // #2964755)
                String selectedText = m_gtpShellText.getSelectedText();
                if (! ObjectUtil.equals(selectedText, m_selectedText))
                {
                    m_listener.textSelected(selectedText);
                    m_selectedText = selectedText;
                }
            }
        };
    m_gtpShellText.addCaretListener(caretListener);
    m_scrollPane =
        new JScrollPane(m_gtpShellText,
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    if (Platform.isMac())
        // Default Apple L&F uses no border, but Quaqua 3.7.4 does
        m_scrollPane.setBorder(null);
    panel.add(m_scrollPane, BorderLayout.CENTER);
    panel.add(createCommandInput(), BorderLayout.SOUTH);
    setMinimumSize(new Dimension(160, 112));
    pack();
}
 
Example 18
Source File: DetailsPanel.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private void initComponents() {        
    table = new DetailsTable();
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JViewport viewport = new Viewport(table);

    final JScrollPane tableScroll = new JScrollPane(
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScroll.setViewport(viewport);
    tableScroll.setBorder(BorderFactory.createEmptyBorder());
    tableScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel());
    
    scrollBar = new ScrollBar(JScrollBar.VERTICAL) {
        public int getUnitIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
        }
        public int getBlockIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
        }
        public void setValues(int newValue, int newExtent, int newMin, int newMax) {
            setEnabled(newExtent < newMax);
            if (isEnabled() && !isSelectionChanging() && isTrackingEnd())
                newValue = newMax - newExtent;
            super.setValues(newValue, newExtent, newMin, newMax);
        }
    };
    tableScroll.setVerticalScrollBar(scrollBar);
    dataContainer = tableScroll;

    JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER);
    noDataLabel.setEnabled(false);
    noDataContainer = new JPanel(new BorderLayout());
    noDataContainer.setOpaque(false);
    noDataContainer.add(noDataLabel, BorderLayout.CENTER);

    setOpaque(false);
    setLayout(new BorderLayout());
    add(noDataContainer, BorderLayout.CENTER);
}
 
Example 19
Source File: HelpPlayerDialog.java    From dualsub with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void initComponents() {
	// Features
	final int marginLeft = 23;
	this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	this.setResizable(false);
	getContentPane().setLayout(new BorderLayout());
	JPanel panel = new JPanel();
	panel.setLayout(null);
	panel.setPreferredSize(new Dimension(getWidth(), getHeight() + 140));
	panel.setBackground(parent.getBackground());
	JScrollPane scroll = new JScrollPane(panel,
			JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
			JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	getContentPane().add(scroll);

	// Title
	final String title = I18N.getHtmlText("PanelOutput.border.text");
	setTitle(I18N.getText("Window.name.text"));
	JLabel lblTitle = new JLabel(title);
	lblTitle.setFont(new Font("Lucida", Font.BOLD, 20));
	lblTitle.setBounds(marginLeft, 21, 435, 25);
	panel.add(lblTitle);

	// Content
	JLabel lblContent01 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.01"));
	lblContent01.setBounds(marginLeft, 50, 435, 120);
	panel.add(lblContent01);

	JButton lblContent02 = new UrlButton(I18N.getHtmlText(
			"HelpPlayerDialog.help.02", Html.LINK), parent.getCursor(),
			parent.getBackground(), new Rectangle(marginLeft + 20, 170,
					240, 20));
	panel.add(lblContent02);

	UrlButton lblContent03 = new UrlButton(I18N.getHtmlText(
			"HelpPlayerDialog.help.03", Html.LINK), parent.getCursor(),
			parent.getBackground(), new Rectangle(marginLeft + 20, 190,
					240, 20));
	panel.add(lblContent03);

	UrlButton lblContent04 = new UrlButton(I18N.getHtmlText(
			"HelpPlayerDialog.help.04", Html.LINK), parent.getCursor(),
			parent.getBackground(), new Rectangle(marginLeft + 20, 210,
					240, 20));
	panel.add(lblContent04);

	JLabel lblContent05 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.05"));
	lblContent05.setBounds(marginLeft, 230, 435, 180);
	panel.add(lblContent05);

	JLabel lblContent06 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.06"));
	lblContent06.setBounds(marginLeft, 410, 435, 100);
	panel.add(lblContent06);

	JLabel lblContent07 = new JLabel(
			I18N.getHtmlText("HelpPlayerDialog.help.07"));
	lblContent07.setBounds(marginLeft + 20, 510, 415, 40);
	panel.add(lblContent07);

	// Borders (for debug purposes)
	if (log.isTraceEnabled()) {
		Border border = BorderFactory.createLineBorder(Color.black);
		lblTitle.setBorder(border);
		lblContent01.setBorder(border);
		lblContent02.setBorderPainted(true);
		lblContent02.setBorder(border);
		lblContent03.setBorder(border);
		lblContent03.setBorderPainted(true);
		lblContent04.setBorder(border);
		lblContent04.setBorderPainted(true);
		lblContent05.setBorder(border);
		lblContent06.setBorder(border);
		lblContent07.setBorder(border);
		panel.setBorder(border);
	}
}
 
Example 20
Source File: MarvinEditor.java    From marvinproject with GNU Lesser General Public License v3.0 votes vote down vote up
/**
	 * Constructs Marvin main class with arguments
	 * 
	 * @param a_args Arguments
	 * <p>
	 * NOTE: Marvin supports 2 arguments at initialization: 
	 * {@code windowBounds(x, y, width, height)} and {@code windowState(state)}.
	 * <br>
	 * These arguments are useful when it's working with 2 screens. 
	 * Assume second screen is set like "LEFT" and it has 1024x768 resolution. 
	 * It's possible opening Marvin directly to the second screen: 
	 * <br><br>
	 * <strong>java -cp ".";"./bin" kernel.Marvin windowBounds(-1024,0,800,600) windowState(max)</strong>
	 * <br><br>
	 * This way could help in working source code and IDE with the main screen and testing Marvin in other one.
	 */
	public MarvinEditor(String a_args[]) {
		super("MARVIN");
		loadMenuBar(); 		// Menu bars
		
		panelMain = new JPanel();
		titlep = BorderFactory.createTitledBorder("Image");
		panelMain.setBorder(titlep);
		panelMain.setSize(600, 600);
		panelMain.setLayout(new BorderLayout());
		add(panelMain);

		imagePanel = new MarvinImagePanel();
		imagePanel.enableHistory();		
		imagePanel.setImage(image);
		imageScrollPane = new JScrollPane(imagePanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		panelMain.add(imageScrollPane);
		
		// loads the File Chooser class.
		new JFileChooser();
		
		//performanceMeter = new MarvinPerformanceMeter();
		//add(performanceMeter.getPanel(), BorderLayout.SOUTH);

		newImage(500,500);
		treatArgs(a_args);
		marvin = this;
		
		setSize(800,600); 	// Default size
		setVisible(true);
	}