本文整理汇总了Java中javax.swing.JScrollPane类的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane类的具体用法?Java JScrollPane怎么用?Java JScrollPane使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JScrollPane类属于javax.swing包,在下文中一共展示了JScrollPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: erzeugeMedienAnzeiger
import javax.swing.JScrollPane; //导入依赖的package包/类
/**
* 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);
}
示例2: initialize
import javax.swing.JScrollPane; //导入依赖的package包/类
/**
* Initialize the contents of the frame.
*/
public void initialize(){
JPanel panel_7 = new JPanel();
panel_7.setBounds(0, 0, 665, 415);
frmPiattaformaGaming.getContentPane().add(panel_7);
panel_7.setLayout(new MigLayout());
panel_7.setVisible(true);
JTextArea ta = new JTextArea();
ta.setEditable(false);
panel_7.add(ta);
ArrayList<Recensione> al = new GiocoController(gioco).allReviews();
for( Recensione r : al ){
ta.setText(ta.getText() + " - " + r.getTesto() + "\n\n");
}
JButton btnBack = new JButton("Indietro");
panel_7.add(btnBack, "pos 267px 345px, width 110, height 15");
JScrollPane scroll = new JScrollPane(ta);
scroll.setVerticalScrollBarPolicy ( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
scroll.getVerticalScrollBar().setUnitIncrement(20);
scroll.setSize(460,240);
panel_7.add(scroll, "pos 0px 0px, width 660, height 340");
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
panel_7.setVisible(false);
new GiocoView(frmPiattaformaGaming, utente, gioco);
}});
}
示例3: UpdateUIRecursionTest
import javax.swing.JScrollPane; //导入依赖的package包/类
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);
}
示例4: initComponents
import javax.swing.JScrollPane; //导入依赖的package包/类
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))
);
}
示例5: highlightNext
import javax.swing.JScrollPane; //导入依赖的package包/类
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;
}
}
示例6: setupUI
import javax.swing.JScrollPane; //导入依赖的package包/类
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);
}
示例7: planRecieved
import javax.swing.JScrollPane; //导入依赖的package包/类
/**
* 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();
}
}
示例8: CompletionPopup
import javax.swing.JScrollPane; //导入依赖的package包/类
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);
}
示例9: uninstallDefaults
import javax.swing.JScrollPane; //导入依赖的package包/类
@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;
}
}
示例10: DatabaseViewer
import javax.swing.JScrollPane; //导入依赖的package包/类
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();
}
示例11: jButton1ActionPerformed
import javax.swing.JScrollPane; //导入依赖的package包/类
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();
}
}
}
示例12: SimulationExplorer
import javax.swing.JScrollPane; //导入依赖的package包/类
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);
}
示例13: CourseListPanel
import javax.swing.JScrollPane; //导入依赖的package包/类
/**
* 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);
}
示例14: createAndShow
import javax.swing.JScrollPane; //导入依赖的package包/类
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);
}
示例15: Server
import javax.swing.JScrollPane; //导入依赖的package包/类
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
}