Les composants JTable et JScrollBar en java
Fermé
mohamed sylla
-
9 avril 2002 à 13:35
trectrec Messages postés 2 Date d'inscription lundi 18 juin 2007 Statut Membre Dernière intervention 25 juin 2007 - 25 juin 2007 à 17:53
trectrec Messages postés 2 Date d'inscription lundi 18 juin 2007 Statut Membre Dernière intervention 25 juin 2007 - 25 juin 2007 à 17:53
A voir également:
- Les composants JTable et JScrollBar en java
- Connaitre les composants de son pc - Guide
- Waptrick java football - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Bible java - Forum Téléchargement
- Jeux java football - Télécharger - Jeux vidéo
4 réponses
choubaka
Messages postés
39367
Date d'inscription
jeudi 4 avril 2002
Statut
Modérateur
Dernière intervention
12 mars 2024
2 100
10 avril 2002 à 08:04
10 avril 2002 à 08:04
essaye un JScrollPane au lieu d'un JScrollBar
Chouba
"Obsédé des travaux manuels non pratiquant"
Chouba
"Obsédé des travaux manuels non pratiquant"
trectrec
Messages postés
2
Date d'inscription
lundi 18 juin 2007
Statut
Membre
Dernière intervention
25 juin 2007
1
25 juin 2007 à 17:53
25 juin 2007 à 17:53
Un JScrollBar est une seul scrollbar. mais toi tu as besoin de deux. donc pour cela delcare une JScrollPane. avec celle ci tu as la scrollbar horizontal et la scrollbar vertical.
Une JScrollPqne est une rectangle
Une JScrollPqne est une rectangle
choubaka
Messages postés
39367
Date d'inscription
jeudi 4 avril 2002
Statut
Modérateur
Dernière intervention
12 mars 2024
2 100
10 avril 2002 à 08:06
10 avril 2002 à 08:06
voilà ce qui la javadoc, sorry c'est en anglais
Provides a scrollable view of a lightweight component. A JScrollPane manages a viewport, optional vertical and horizontal scroll bars, and optional row and column heading viewports. You can find task-oriented documentation of JScrollPane in How to Use Scroll Panes, a section in The Java Tutorial. Note that JScrollPane does not support heavyweight components.
The JViewport provides a window, or "viewport" onto a data source -- for example, a text file. That data source is the "scrollable client" (aka data model) displayed by the JViewport view. A JScrollPane basically consists of JScrollBars, a JViewport, and the wiring between them, as shown in the diagram at right.
In addition to the scroll bars and viewport, a JScrollPane can have a column header and a row header. Each of these is a JViewport object that you specify with setRowHeaderView, and setColumnHeaderView. The column header viewport automatically scrolls left and right, tracking the left-right scrolling of the main viewport. (It never scrolls vertically, however.) The row header acts in a similar fashion.
By default, the corners are empty. You can put a component into a corner using setCorner, in case you there is some function or decoration you would like to add to the scroll pane. The size of corner components is entirely determined by the size of the headers and scroll bars that surround them.
To add a border around the main viewport, you can use setViewportBorder. (Of course, you can also add a border around the whole scroll pane using setBorder.)
For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JScrollPane key assignments.
A common operation to want to do is to set the background color that will be used if the main viewport view is smaller than the viewport, or is not opaque. This can be accomplished by setting the background color of the viewport, via scrollPane.getViewport().setBackground(). The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when JScrollPane draws its background the viewport will usually draw over it.
By default JScrollPane uses ScrollPaneLayout to handle the layout of its child Components. ScrollPaneLayout determines the size to make the viewport view in one of two ways:
If the view implements Scrollable a combination of getPreferredScrollableViewportSize, getScrollableTracksViewportWidth and getScrollableTracksViewportHeightis used, otherwise
getPreferredSize is used.
Chouba
"Obsédé des travaux manuels non pratiquant"
Provides a scrollable view of a lightweight component. A JScrollPane manages a viewport, optional vertical and horizontal scroll bars, and optional row and column heading viewports. You can find task-oriented documentation of JScrollPane in How to Use Scroll Panes, a section in The Java Tutorial. Note that JScrollPane does not support heavyweight components.
The JViewport provides a window, or "viewport" onto a data source -- for example, a text file. That data source is the "scrollable client" (aka data model) displayed by the JViewport view. A JScrollPane basically consists of JScrollBars, a JViewport, and the wiring between them, as shown in the diagram at right.
In addition to the scroll bars and viewport, a JScrollPane can have a column header and a row header. Each of these is a JViewport object that you specify with setRowHeaderView, and setColumnHeaderView. The column header viewport automatically scrolls left and right, tracking the left-right scrolling of the main viewport. (It never scrolls vertically, however.) The row header acts in a similar fashion.
By default, the corners are empty. You can put a component into a corner using setCorner, in case you there is some function or decoration you would like to add to the scroll pane. The size of corner components is entirely determined by the size of the headers and scroll bars that surround them.
To add a border around the main viewport, you can use setViewportBorder. (Of course, you can also add a border around the whole scroll pane using setBorder.)
For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JScrollPane key assignments.
A common operation to want to do is to set the background color that will be used if the main viewport view is smaller than the viewport, or is not opaque. This can be accomplished by setting the background color of the viewport, via scrollPane.getViewport().setBackground(). The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when JScrollPane draws its background the viewport will usually draw over it.
By default JScrollPane uses ScrollPaneLayout to handle the layout of its child Components. ScrollPaneLayout determines the size to make the viewport view in one of two ways:
If the view implements Scrollable a combination of getPreferredScrollableViewportSize, getScrollableTracksViewportWidth and getScrollableTracksViewportHeightis used, otherwise
getPreferredSize is used.
Chouba
"Obsédé des travaux manuels non pratiquant"
Il ne pourrait pas mettre des JPanel dans un GridLayout de 1 colonne et plusieurs rangées?
Il pourrait ainsi régler chacune des rangées à sa guise non?
Il pourrait ainsi régler chacune des rangées à sa guise non?
choubaka
Messages postés
39367
Date d'inscription
jeudi 4 avril 2002
Statut
Modérateur
Dernière intervention
12 mars 2024
2 100
10 avril 2002 à 15:46
10 avril 2002 à 15:46
il pourrait, mais ça risque de devenir du jabol
Chouba
"Obsédé des travaux manuels non pratiquant"
Chouba
"Obsédé des travaux manuels non pratiquant"
13 avril 2002 à 00:57
Encore une fois merci pour tout.