Java 类javax.swing.JScrollPane 实例源码

项目:SE2Project    文件:MedienDetailAnzeigerUI.java   
/**
 * Erzeugt das Panel in dem die Mediendetails angezeigt werden.
 */
private void erzeugeMedienAnzeiger()
{
    JScrollPane medienAnzeigerScrollPane = new JScrollPane();
    medienAnzeigerScrollPane.setPreferredSize(new Dimension(-1, 160));
    medienAnzeigerScrollPane.setSize(-1, -1);
    medienAnzeigerScrollPane.setBorder(BorderFactory.createTitledBorder(
            null, "Ausgewählte Medien", TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
    medienAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _medienAnzeigerTextArea = new JTextArea();
    _medienAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.setViewportView(_medienAnzeigerTextArea);
    _medienAnzeigerTextArea.setEditable(false);
    _medienAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);

    _hauptPanel.add(medienAnzeigerScrollPane, BorderLayout.CENTER);
}
项目:powertext    文件:Highlights.java   
public static void highlightNext(String findText) {
int sel = jTabbedPane1.getSelectedIndex();
        JTextPane textPane = (JTextPane) ((JScrollPane) ((JDesktopPane)jTabbedPane1.getComponentAt(sel)).getComponent(0)).getViewport().getComponent(0);
if (findText.isEmpty())
        return;
    String context = textPane.getText();
    String wordToFind = findText;
    pos = context.indexOf(wordToFind, currentPos);
    if (pos == -1)
        currentPos = 0;
    pos = context.indexOf(wordToFind, currentPos);
    currentPos = pos;
    if (pos != -1) {
        textPane.setSelectionStart(pos);
        textPane.setSelectionEnd(pos + wordToFind.length());
        textPane.requestFocusInWindow();
        currentPos = (currentPos + 1);
    } else {
        currentPos = 0;
    }
}
项目:openjdk-jdk10    文件:bug8136998.java   
private void setupUI() {
    frame = new JFrame();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    comboBox = new JComboBox<>(ITEMS);

    JPanel scrollable = new JPanel();
    scrollable.setLayout(new BoxLayout(scrollable, BoxLayout.Y_AXIS));

    scrollable.add(Box.createVerticalStrut(200));
    scrollable.add(comboBox);
    scrollable.add(Box.createVerticalStrut(200));

    scrollPane = new JScrollPane(scrollable);

    frame.add(scrollPane);

    frame.setSize(100, 200);
    frame.setVisible(true);
}
项目:Pogamut3    文件:DashWindow.java   
/**
 * We got the plan, create the scene using {@link DashPresenterFactory} and
 * set the window to display it. Also start crawlers that will notify
 * widgets about mapping of FQN to name in {@link PrimitiveInfo} through {@link ShedPresenter}.
 *
 * @param name New display name of the window
 * @param plan Plan to display
 */
@Override
public void planRecieved(String name, PoshPlan plan) {
    setDisplayName(name);
    ShedScene scene = new ShedScene(plan);
    engineData = new EngineData(plan);
    presenter = new DashPresenterFactory(plan, engine, engineData, scene, scene.getPresenter());
    dashScene = LapSceneFactory.createDashScene(plan, scene, presenter);
    setContent(new JScrollPane(dashScene.createView()));

    Project[] openProjects = OpenProjects.getDefault().getOpenProjects();
    Set<Project> openProjectsSet = new HashSet<Project>(Arrays.asList(openProjects));
    {
        ClassCrawler actionCrawler = ClassCrawlerFactory.createActionCrawler(openProjectsSet);
        CrawlerListener<PrimitiveData> actionNameCrawler = new NameMapCrawler(scene.getPresenter());
        actionCrawler.addListener(actionNameCrawler);
        actionCrawler.crawl();
    }
    {
        ClassCrawler senseCrawler = ClassCrawlerFactory.createSenseCrawler(openProjectsSet);
        CrawlerListener<PrimitiveData> senseNameCrawler = new NameMapCrawler(scene.getPresenter());
        senseCrawler.addListener(senseNameCrawler);
        senseCrawler.crawl();
    }
}
项目:incubator-netbeans    文件:CompletionPopup.java   
public CompletionPopup(Completable completable) {
    this.list = new JList();
    enabledColor = list.getForeground();
    list.setVisibleRowCount(4);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.completable = completable;

    JScrollPane jsp = new JScrollPane(list);
    add(jsp);
    list.setFocusable(false);
    jsp.setFocusable(false);
    setFocusable(false);

    list.addFocusListener(new FocusHandler());
    list.addMouseListener(new MouseHandler());
    list.addMouseMotionListener(new MouseHandler());

    completable.addKeyListener(CompletionPopup.this);
}
项目:jdk8u-jdk    文件:XTextAreaPeer.java   
@Override
protected void uninstallDefaults(JScrollPane c) {
    super.uninstallDefaults(c);

    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (vsb.getBorder() == vsbBorder) {
            vsb.setBorder(null);
        }
        vsbBorder = null;
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        if (hsb.getBorder() == hsbBorder) {
            hsb.setBorder(null);
        }
        hsbBorder = null;
    }
}
项目:JITRAX    文件:DatabaseViewer.java   
public DatabaseViewer() {
    selectedDatabaseViewer = new SelectedDatabaseViewer();
    tablesViewer = new TablesViewer();
    selectedTableViewer = new SelectedTableViewer();

    setLayout(new BorderLayout());

    JScrollPane tablesSP = new JScrollPane(tablesViewer);
    tablesSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    tablesSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
            tablesSP, selectedTableViewer);

    splitPane.setResizeWeight(SPLIT_WEIGHT);
    selectedDatabaseViewer.setBorder(BorderFactory.createEmptyBorder(DBVIEWER_TOP_PADDING, 0, 0, 0));

    add(selectedDatabaseViewer, BorderLayout.NORTH);
    add(splitPane, BorderLayout.CENTER);

    LineBorder lineBorderPanel = (LineBorder) BorderFactory.createLineBorder(PANEL_BORDER_COLOR);
    setBorder(BorderFactory.createTitledBorder(lineBorderPanel, PANEL_TITLE));

    setListeners();
}
项目:incubator-netbeans    文件:ImageCacheTest.java   
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    fd.show(true);
    if (fd.getDirectory() != null && fd.getFile() != null) {
        String filename = fd.getDirectory() + fd.getFile();
        try {
            File f = new File(filename);
            BufferedImage img = ImageIO.read(f);
            imgs.add (filename);
            ImagePanel ip = new ImagePanel(img);
            ip.setName (filename);
            System.err.println("Created " + ip);
            jTabbedPane1.insertTab(f.getName(), null, new JScrollPane(ip), filename, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
项目:Logisim    文件:SimulationExplorer.java   
SimulationExplorer(Project proj, MenuListener menu) {
    super(new BorderLayout());
    this.project = proj;

    SimulationToolbarModel toolbarModel = new SimulationToolbarModel(proj, menu);
    Toolbar toolbar = new Toolbar(toolbarModel);
    add(toolbar, BorderLayout.NORTH);

    model = new SimulationTreeModel(proj.getSimulator().getCircuitState());
    model.setCurrentView(project.getCircuitState());
    tree = new JTree(model);
    tree.setCellRenderer(new SimulationTreeRenderer());
    tree.addMouseListener(this);
    tree.setToggleClickCount(3);
    add(new JScrollPane(tree), BorderLayout.CENTER);
    proj.addProjectListener(this);
}
项目:Course-Management-System    文件:CourseListPanel.java   
/**
 * Create the panel.
 */
public CourseListPanel(String user,ProfessorFrame pf) throws Exception{
    setLayout(new BorderLayout(0, 0));
       TableCellRenderer buttonRenderer = new ButtonRenderer();
    dao = new ProfessorDAO();
    model=new tableModelTeach(dao.getAllCourses(user),user,pf);
    table = new JTable();
    table.setRowHeight(30);

    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setDefaultRenderer(JButton.class,buttonRenderer);
    table.addMouseListener(new JTableButtonMouseListener(table));
    table.setModel(model);
    JScrollPane scrollPane = new JScrollPane(table,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    //resizeColumnWidth(table);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    TableColumnModel tcm = table.getColumnModel();
    tcm.getColumn(0).setPreferredWidth(800);    
    tcm.getColumn(1).setPreferredWidth(200);    

    scrollPane.setBounds(10, 57, 1320, 450);
    add(scrollPane, BorderLayout.CENTER);
}
项目:openjdk-jdk10    文件:UpdateUIRecursionTest.java   
public UpdateUIRecursionTest() {
    super("UpdateUIRecursionTest");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 400);

    String[] listData = {
        "First", "Second", "Third", "Fourth", "Fifth", "Sixth"
    };

    list = new JList(listData);
    list.setCellRenderer(this);
    renderer = new DefaultListCellRenderer();
    getContentPane().add(new JScrollPane(list), BorderLayout.CENTER);

    setVisible(true);
}
项目:EditCalculateAndChart    文件:HelpFrame.java   
public void createAndShow() throws Exception{
    Preferences Config = TEdit.getConfig();
    JTextArea area = new JTextArea(10,40);
    area.setEditable(false);
              String Font_Name =  Config.get("FONT_NAME","Monospaced");
              int Font_Size = Config.getInt("FONT_SIZE",12);
              int Font_Style = Config.getInt("FONT_STYLE",Font.PLAIN);
              area.setFont(new Font(Font_Name,Font_Style,Font_Size));
                JScrollPane scroll = new JScrollPane(area,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        this.add(scroll,BorderLayout.CENTER);
                if(txt == null){
                    BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("org/ioblako/edit/resources/Help.txt"), "UTF-8"));
                     for (int c = br.read(); c != -1; c = br.read()) sb.append((char)c);
                     txt=sb.toString();
                }

                area.setText(txt);
                this.setTitle("Help");
                this.pack();
                this.setVisible(true);

}
项目:LivroJavaComoProgramar10Edicao    文件:Server.java   
public Server()
{
   super("Server");

   enterField = new JTextField(); // create enterField
   enterField.setEditable(false);
   enterField.addActionListener(
      new ActionListener() 
      {
         // send message to client
         public void actionPerformed(ActionEvent event)
         {
            sendData(event.getActionCommand());
            enterField.setText("");
         } 
      } 
   ); 

   add(enterField, BorderLayout.NORTH);

   displayArea = new JTextArea(); // create displayArea
   add(new JScrollPane(displayArea), BorderLayout.CENTER);

   setSize(300, 150); // set size of window
   setVisible(true); // show window
}
项目:openjdk-jdk10    文件:XDataViewer.java   
public static void registerForMouseEvent(Component comp,
                                         MouseListener mouseListener) {
    if(comp instanceof JScrollPane) {
        JScrollPane pane = (JScrollPane) comp;
        comp = pane.getViewport().getView();
    }
    if(comp instanceof Container) {
        Container container = (Container) comp;
        Component[] components = container.getComponents();
        for(int i = 0; i < components.length; i++) {
            registerForMouseEvent(components[i], mouseListener);
        }
    }

    //No registration for XOpenTypedata that are themselves clickable.
    //No registration for JButton that are themselves clickable.
    if(comp != null &&
       (!(comp instanceof XOpenTypeViewer.XOpenTypeData) &&
        !(comp instanceof JButton)) )
        comp.addMouseListener(mouseListener);
}
项目:ramus    文件:StatusMessageFormat.java   
public static boolean deleteElements(DeleteStatusList list,
                                     JComponent component, GUIFramework framework) {

    final JLabel label = new JLabel(toMessage(list, framework));
    final JScrollPane pane = new JScrollPane();
    pane.setBorder(null);
    pane.setViewportView(label);
    final Dimension d = label.getPreferredSize();
    final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    boolean b = false;
    if (d.width >= screen.width * 0.7) {
        d.width = (int) (screen.width * 0.7);
        b = true;
    } else
        d.width += 20;
    if (d.height >= screen.height / 2) {
        d.height = screen.height / 2;
        b = true;
    } else
        d.height += 20;
    if (b)
        pane.setPreferredSize(d);

    int r = JOptionPane.showOptionDialog(component, new Object[]{
                    pane,
                    new JLabel(GlobalResourcesManager
                            .getString("DeleteActiveElementsDialog.Warning"))},
            GlobalResourcesManager.getString("ConfirmMessage.Title"),
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
            null, null);

    if (JOptionPane.YES_OPTION == r) {
        return true;
    }
    return false;
}
项目:jmeter-bzm-plugins    文件:ViewResultsFullVisualizer.java   
private synchronized Component createLeftPanel() {
    SampleResult rootSampleResult = new SampleResult();
    rootSampleResult.setSampleLabel("Root");
    rootSampleResult.setSuccessful(true);
    root = new SearchableTreeNode(rootSampleResult, null);

    treeModel = new DefaultTreeModel(root);
    jTree = new JTree(treeModel);
    jTree.setCellRenderer(new ResultsNodeRenderer());
    jTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    jTree.addTreeSelectionListener(this);
    jTree.setRootVisible(false);
    jTree.setShowsRootHandles(true);
    JScrollPane treePane = new JScrollPane(jTree);
    treePane.setPreferredSize(new Dimension(200, 300));

    VerticalPanel leftPane = new VerticalPanel();
    leftPane.add(treePane, BorderLayout.CENTER);
    leftPane.add(createComboRender(), BorderLayout.NORTH);
    autoScrollCB = new JCheckBox(JMeterUtils.getResString("view_results_autoscroll")); // $NON-NLS-1$
    autoScrollCB.setSelected(false);
    autoScrollCB.addItemListener(this);
    leftPane.add(autoScrollCB, BorderLayout.SOUTH);
    return leftPane;
}
项目:openjdk-jdk10    文件:XTextAreaPeer.java   
@Override
protected void uninstallDefaults(JScrollPane c) {
    super.uninstallDefaults(c);

    JScrollBar vsb = scrollpane.getVerticalScrollBar();
    if (vsb != null) {
        if (vsb.getBorder() == vsbBorder) {
            vsb.setBorder(null);
        }
        vsbBorder = null;
    }

    JScrollBar hsb = scrollpane.getHorizontalScrollBar();
    if (hsb != null) {
        if (hsb.getBorder() == hsbBorder) {
            hsb.setBorder(null);
        }
        hsbBorder = null;
    }
}
项目:grade-buddy    文件:TextAreaCellEditor.java   
/**
 * Default constructor.
 */
public TextAreaCellEditor() {
    scroll = new JScrollPane(textArea);
    scroll.setBorder(BorderFactory.createEmptyBorder());
    //scroll.setViewportBorder(BorderFactory.createEmptyBorder());
    textArea.setLineWrap(true);
    textArea.setBorder(BorderFactory.createEmptyBorder(1, 5, 1, 5));
    KeyStroke enter = KeyStroke.getKeyStroke(
        KeyEvent.VK_ENTER,
        InputEvent.CTRL_MASK
    );
    textArea.getInputMap(JComponent.WHEN_FOCUSED)
        .put(enter, new AbstractAction() {
            /**
             * Serial version UID.
             */
            private static final long serialVersionUID = 3349088268669286994L;

            @Override
            public void actionPerformed(ActionEvent e) {
                stopCellEditing();
            }
        });
}
项目:zencash-swing-wallet-ui    文件:AddressesPanel.java   
private synchronized void updateWalletAddressBalanceTableInteractive()
    throws WalletCallException, IOException, InterruptedException
{
    this.lastInteractiveRefresh = System.currentTimeMillis();

    String[][] newAddressBalanceData = this.getAddressBalanceDataFromWallet();

    if (Util.arraysAreDifferent(lastAddressBalanceData, newAddressBalanceData))
    {
        Log.info("Updating table of addresses/balances I...");
        this.remove(addressBalanceTablePane);
        this.add(addressBalanceTablePane = new JScrollPane(
                     addressBalanceTable = this.createAddressBalanceTable(newAddressBalanceData)),
                 BorderLayout.CENTER);
        lastAddressBalanceData = newAddressBalanceData;

        this.validate();
        this.repaint();
    }
}
项目:Logisim    文件:ProjectLibraryActions.java   
public static void doUnloadLibraries(Project proj) {
    LogisimFile file = proj.getLogisimFile();
    ArrayList<Library> canUnload = new ArrayList<Library>();
    for (Library lib : file.getLibraries()) {
        String message = file.getUnloadLibraryMessage(lib);
        if (message == null)
            canUnload.add(lib);
    }
    if (canUnload.isEmpty()) {
        JOptionPane.showMessageDialog(proj.getFrame(), Strings.get("unloadNoneError"),
                Strings.get("unloadErrorTitle"), JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    LibraryJList list = new LibraryJList(canUnload);
    JScrollPane listPane = new JScrollPane(list);
    int action = JOptionPane.showConfirmDialog(proj.getFrame(), listPane, Strings.get("unloadLibrariesDialogTitle"),
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
    if (action == JOptionPane.OK_OPTION) {
        Library[] libs = list.getSelectedLibraries();
        if (libs != null)
            proj.doAction(LogisimFileActions.unloadLibraries(libs));
    }
}
项目:jdk8u-jdk    文件:XTextAreaPeer.java   
private void setScrollBarVisibility() {
    int visibility = ((TextArea)target).getScrollbarVisibility();
    jtext.setLineWrap(false);

    if (visibility == TextArea.SCROLLBARS_NONE) {
        textPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        textPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
        jtext.setLineWrap(true);
    }
    else if (visibility == TextArea.SCROLLBARS_BOTH) {

        textPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        textPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    }
    else if (visibility == TextArea.SCROLLBARS_VERTICAL_ONLY) {
        textPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        textPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        jtext.setLineWrap(true);
    }
    else if (visibility == TextArea.SCROLLBARS_HORIZONTAL_ONLY) {
        textPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
        textPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    }
}
项目:openjdk-jdk10    文件:TableExample2.java   
public TableExample2(String URL, String driver, String user,
        String passwd, String query) {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    JDBCAdapter dt = new JDBCAdapter(URL, driver, user, passwd);
    dt.executeQuery(query);

    // Create the table
    JTable tableView = new JTable(dt);

    JScrollPane scrollpane = new JScrollPane(tableView);
    scrollpane.setPreferredSize(new Dimension(700, 300));

    frame.getContentPane().add(scrollpane);
    frame.pack();
    frame.setVisible(true);
}
项目:VASSAL-src    文件:SetupStack.java   
public void scrollAtEdge(Point evtPt, int dist) {
  JScrollPane scroll = myStack.stackConfigurer.getScroll();

  Point p = new Point(evtPt.x - scroll.getViewport().getViewPosition().x,
      evtPt.y - scroll.getViewport().getViewPosition().y);
  int dx = 0, dy = 0;
  if (p.x < dist && p.x >= 0)
    dx = -1;
  if (p.x >= scroll.getViewport().getSize().width - dist
      && p.x < scroll.getViewport().getSize().width)
    dx = 1;
  if (p.y < dist && p.y >= 0)
    dy = -1;
  if (p.y >= scroll.getViewport().getSize().height - dist
      && p.y < scroll.getViewport().getSize().height)
    dy = 1;

  if (dx != 0 || dy != 0) {
    Rectangle r = new Rectangle(scroll.getViewport().getViewRect());
    r.translate(2 * dist * dx, 2 * dist * dy);
    r = r.intersection(new Rectangle(new Point(0, 0), getPreferredSize()));
    scrollRectToVisible(r);
  }
}
项目:ramus    文件:ScriptEditor.java   
@Override
public JComponent createComponent() {
    JScrollPane pane = new JScrollPane();
    editorPane = new JEditorPane();
    pane.setViewportView(editorPane);
    if (scriptPath.endsWith(".js"))
        editorPane.setContentType("text/javascript");
    byte[] bs = framework.getEngine().getStream(scriptPath);
    if (bs == null)
        bs = new byte[]{};
    try {
        editorPane.setText(new String(bs, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    if (!saveScriptAction.isEnabled())
        editorPane.setEditable(false);
    return pane;
}
项目:incubator-netbeans    文件:PopupPane.java   
public void addListComponent(final ListComponent lst) {
    Mutex.EVENT.readAccess(new Runnable() {            
        public @Override void run() {
            listComponents.add(lst);
            if (view.getComponentCount() > 0) {
                JComponent previous = (JComponent)view.getComponent(view.getComponentCount() - 1);
                previous.setBorder(new BottomLineBorder());
            }
            lst.setBorder(BorderFactory.createEmptyBorder());
            view.add(lst);
            if (listComponents.size() > 3) {
                setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            } else {
                setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
            }
        }
    });
}
项目:SE2Project    文件:KundenauflisterUI.java   
/**
 * Erzeugt die Tabelle für die Anzeige der Kunden.
 */
private void erzeugeKundenTable()
{
    JScrollPane kundenAuflisterScrollPane = new JScrollPane();
    kundenAuflisterScrollPane.setBorder(BorderFactory.createTitledBorder(
            null, "Kunden", TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
    kundenAuflisterScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    kundenAuflisterScrollPane.getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    kundenAuflisterScrollPane.getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _kundenTableModel = new KundenTableModel();
    _kundenTable = new JTable();
    kundenAuflisterScrollPane.setViewportView(_kundenTable);
    _kundenTable.setModel(_kundenTableModel);
    _kundenTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JTableHeader tableHeader = _kundenTable.getTableHeader();
    tableHeader.setFont(UIConstants.HEADER_FONT);
    tableHeader.setReorderingAllowed(false);
    tableHeader.setResizingAllowed(false);
    _kundenTable.setFont(UIConstants.TEXT_FONT);

    _hauptPanel.add(kundenAuflisterScrollPane, BorderLayout.CENTER);
}
项目:Tarski    文件:EvaluatorPanel.java   
public static JScrollPane getInstance(final String xmlPath) {
  final Evaluator evaluator = new Evaluator();
  final JScrollPane instance = new OurConsole(evaluator, true, "Expression Evaluator Pane");
  /*
   * final JScrollPane instance = new OurConsole(evaluator, true, "The ", true,
   * "Alloy Evaluator ", false,
   * "allows you to type\nin Alloy expressions and see their values.\nFor example, ", true,
   * "univ", false,
   * " shows the list of all atoms.\n(You can press UP and DOWN to recall old inputs).\n");
   */
  try {
    evaluator.compute(new File(xmlPath));
  } catch (final Exception ex) {
  } // exception should not happen
  return instance;
}
项目:incubator-netbeans    文件:IssueTable.java   
private void initComponents(JScrollPane tablePane, FindInQueryBar findBar) {
    GroupLayout layout = new GroupLayout(component);
    component.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addComponent(findBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(tablePane, GroupLayout.DEFAULT_SIZE, 549, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
            .addComponent(tablePane, GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
            .addGap(0, 0, 0)
            .addComponent(findBar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    );
}
项目:Moenagade    文件:MainFrame.java   
private void openImagfile(ImageFile imageFile)
{
    // eanble scrolling
    editorScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    editorScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);

    JLabel label = new JLabel();
    label.setIcon(new ImageIcon(imageFile.getAbsolutePath()));
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setVerticalAlignment(JLabel.CENTER);
    label.setBackground(BloxsColors.$BACKGROUND);
    label.setOpaque(true);

    editorScroller.getViewport().add(label);
    editorScroller.getViewport().validate();
    editorScroller.repaint();
}
项目:JITRAX    文件:TablesManagerWindow.java   
private void buildRightPanel() {
    JPanel tableButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

    // Buttons
    tableButtonPanel.add(newRowButton);
    tableButtonPanel.add(removeRowButton);

    JPanel southButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    southButtonPanel.add(insertButton);
    selectedTableViewer.add(tableButtonPanel, BorderLayout.NORTH);
    selectedTableViewer.add(southButtonPanel, BorderLayout.SOUTH);

    JScrollPane contentTablePanelSP = new JScrollPane(selectedTableViewer);
    contentTablePanelSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    // Remove ugly borders
    contentTablePanelSP.setViewportBorder(null);

    JPanel bottomPanel = new JPanel(new BorderLayout());
    JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonsPanel.add(doneButton);
    bottomPanel.add(buttonsPanel, BorderLayout.SOUTH);
    getRightPanel().add(selectedTableViewer, BorderLayout.CENTER);
    getRightPanel().add(bottomPanel, BorderLayout.SOUTH);
}
项目:freecol    文件:StatisticsPanel.java   
/**
 * Creates the statistics panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param serverStatistics A map of key,value pairs of server statistics.
 * @param clientStatistics A map of key,value pairs of client statistics.
 */
public StatisticsPanel(FreeColClient freeColClient,
                       Map<String, String> serverStatistics,
                       Map<String, String> clientStatistics) {
    super(freeColClient, new BorderLayout());

    // Title
    JPanel header = new JPanel();
    this.add(header, BorderLayout.PAGE_START);
    header.add(Utility.localizedLabel("statistics"), JPanel.CENTER_ALIGNMENT);

    // Actual stats panel
    JPanel statsPanel = new JPanel(new GridLayout(1,2));
    JScrollPane scrollPane = new JScrollPane(statsPanel,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // correct way to make scroll pane opaque
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);

    this.add(scrollPane,BorderLayout.CENTER);
    statsPanel.add(displayStatsMessage("client", clientStatistics));
    statsPanel.add(displayStatsMessage("server", serverStatistics));

    add(okButton, BorderLayout.PAGE_END);

    setSize(getPreferredSize());
}
项目:MaxSim    文件:SnapshotTopComponent.java   
public SnapshotTopComponent() {
    initComponents();
    setName("Snapshot Window");
    setToolTipText("This is a Snapshot window");

    result = LookupUtils.getLastActiveDelegatingLookup(EditorTopComponent.class).lookupResult(RangeSliderModel.class);
    result.addLookupListener(lookupListener);
    this.rangeSlider = new RangeSlider(null);
    this.setLayout(new BorderLayout());
    final JScrollPane scrollPane = new JScrollPane(rangeSlider);
    scrollPane.getVerticalScrollBar().setUnitIncrement(RangeSlider.ITEM_HEIGHT);
    this.add(scrollPane, BorderLayout.CENTER);
    update();
}
项目:openjdk-jdk10    文件:JScrollPaneOperator.java   
/**
 * Maps {@code JScrollPane.getViewportBorder()} through queue
 */
public Border getViewportBorder() {
    return (runMapping(new MapAction<Border>("getViewportBorder") {
        @Override
        public Border map() {
            return ((JScrollPane) getSource()).getViewportBorder();
        }
    }));
}
项目:gate-core    文件:CorefEditor.java   
public NewCorefAction() {
  popupWindow = new JWindow(SwingUtilities.getWindowAncestor(textView.
      getGUI()));
  popupWindow.setBackground(UIManager.getLookAndFeelDefaults().
                            getColor("ToolTip.background"));
  mainPanel.setLayout(new BorderLayout());
  mainPanel.setOpaque(true);
  mainPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
  mainPanel.setBackground(UIManager.getLookAndFeelDefaults().
                          getColor("ToolTip.background"));
  popupWindow.setContentPane(mainPanel);

  panel.setLayout(new BorderLayout());
  panel.setOpaque(false);
  panel.add(new JScrollPane(list), BorderLayout.CENTER);

  subPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
  subPanel.add(add);
  subPanel.add(cancel);
  subPanel.setOpaque(false);
  panel.add(subPanel, BorderLayout.SOUTH);
  mainPanel.add(label, BorderLayout.NORTH);
  mainPanel.add(panel, BorderLayout.CENTER);

  // and finally load the data for the list
  AddAction action = new AddAction();
  add.addActionListener(action);
  cancel.addActionListener(action);
  listEditor = new ListEditor(action);
  list.setMaximumRowCount(5);
  list.setEditable(true);
  list.setEditor(listEditor);
  list.setModel(model);
}
项目:QN-ACTR-Release    文件:ExactTable.java   
/**
 * duplicated to avoid repeating the same checks multiple times
 */
@Override
protected void configureEnclosingScrollPane() {
    Container p = getParent();
    if (p instanceof JViewport) {
        Container gp = p.getParent();
        if (gp instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane) gp;
            // Make certain we are the viewPort's view and not, for
            // example, the rowHeaderView of the scrollPane -
            // an implementor of fixed columns might do this.
            JViewport viewport = scrollPane.getViewport();
            if (viewport == null || viewport.getView() != this) {
                return;
            }
            scrollPane.setColumnHeaderView(getTableHeader());
            Border border = scrollPane.getBorder();
            if (border == null || border instanceof UIResource) {
                scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
            }
            //rowHeader=new RowHeader(dataModel);
            rowHeader.install(this, scrollPane);
            installLabels(scrollPane);
            installSelectAllButton(scrollPane);
            viewport.addChangeListener(scrollListener);
        }
    }
}
项目:QN-ACTR-Release    文件:LogVisualizer.java   
public LogVisualizer(JDialog d) {
    this.d = d;
    this.setLayout(new BorderLayout());
    logList = new JList(new DefaultListModel());
    JScrollPane p = new JScrollPane(logList);
    this.add(p, BorderLayout.CENTER);
    loadData();
}
项目:openjdk-jdk10    文件:ThemeReaderCrashTest.java   
ThemeReaderCrashTest() {
    JPanel panel = new JPanel();
    JScrollPane pane =
        new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.setSize(300, 200);

    panel.add(pane);
}
项目:parabuild-ci    文件:ChartFrame.java   
/**
 * Constructs a frame for a chart.
 *
 * @param title  the frame title.
 * @param chart  the chart.
 * @param scrollPane  iIf <code>true</code>, put the Chart(Panel) into a JScrollPane.
 */
public ChartFrame(String title, JFreeChart chart, boolean scrollPane) {

    super(title);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.chartPanel = new ChartPanel(chart);
    if (scrollPane) {
        setContentPane(new JScrollPane(this.chartPanel));
    }
    else {
        setContentPane(this.chartPanel);
    }

}
项目:chipKIT-importer    文件:ProgressTrackingPanel.java   
private JComponent createImportFailedPane( Exception cause ) {
    JLabel infoLabel = new JLabel( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.importFailedMessage" ));
    infoLabel.setHorizontalAlignment(JLabel.CENTER );
    infoLabel.setBackground(Color.red);
    infoLabel.setOpaque(true);
    infoLabel.setBorder( BorderFactory.createLineBorder(Color.red, 3) );

    ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
    PrintWriter printWriter = new PrintWriter( arrayOutputStream );
    cause.printStackTrace( printWriter );
    printWriter.flush();
    String stackTraceText = arrayOutputStream.toString();

    JTextArea stackTraceTextArea = new JTextArea( stackTraceText );
    stackTraceTextArea.setEditable(false);

    JScrollPane scrollPane = new JScrollPane( stackTraceTextArea );        

    JButton copyToClipboardButton = new JButton( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.copyToClipboard" ));
    copyToClipboardButton.addActionListener( (a) -> {
        Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
        defaultToolkit.getSystemClipboard().setContents( new StringSelection(stackTraceText), null );
    });

    JPanel p1 = new JPanel( new FlowLayout(FlowLayout.TRAILING) );
    p1.add( copyToClipboardButton );

    JPanel p2 = new JPanel( new BorderLayout(0, 10) );
    p2.add( infoLabel, BorderLayout.NORTH );
    p2.add( scrollPane, BorderLayout.CENTER );        
    p2.add( p1, BorderLayout.SOUTH );
    p2.setSize( new Dimension(600,400) );
    p2.setMinimumSize( p2.getSize() );
    p2.setPreferredSize( p2.getSize() );

    return p2;
}
项目:VASSAL-src    文件:ServerStatusView.java   
private void buildHistoricalTabs() {
  while (getTabCount() > 1) {
    removeTabAt(getTabCount()-1);
  }
  if (status != null) {
    String[] supported = status.getSupportedTimeRanges();
    historicalTrees = new JTree[supported.length];
    historicalModels = new DefaultTreeModel[supported.length];
    for (int i = 0; i < supported.length; i++) {
      historicalTrees[i] = createTree();
      historicalModels[i] = (DefaultTreeModel) historicalTrees[i].getModel();
      addTab(supported[i], new JScrollPane(historicalTrees[i]));
    }
  }
}