JTable Horizontal Scroll WHEN NEEDED fix?
Me again....
JTable in a JScrollPane When the Jtable width exceeds the scrollpane I would like a horizontal scrollbar to appear. If the Jtable does not exceed the width Id like it to fill the ScrollPane.
If I use the AUTO_RESIZE_OFF I get a horizontal scrollbar all the time. I dont want this if possible.
I did try to overwrite getScrollableTracksViewportWidth() and getPreferredSize() as suggested by work around http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4127936
However this bug is not exactly what I am having trouble with.
Anyone know what I can do for this?
Thanks
B.
You're welcome.
Autoscrolling means that you can middle click on a web page and then get a scroll icon to indicate that you can move the mouse up or down to scroll the page automatically.
Similar Messages
-
JTABLE - horizontal scrolling only for some columns
Hi all,
In my JTABLE I have to scroll the horizontal scrollbar only from column 5 to the last, the columns 0 - 4 should be fixed ! Is this possible ?
Thanks in advance,
ArpanaPlease see
http://www.senun.com/Left/Programming/Java_old/Examples_swing/JTableExamples1.html
http://www.senun.com/Left/Programming/Java_old/Examples_swing/src/examples/FixedColumnExample.java -
JTextPane in JScrollPane... Scrolling when needed
Hello all.
I have a jtextpane in a jscrollpane and I'm using the following code to append a line in jtextpane and set the vertical scrollbar of jscrollpane at the bottom...
htmlDoc = (HTMLDocument) output.getDocument();
htmlKit.insertHTML(htmlDoc, htmlDoc.getLength(), s, 0, 0, null);
output.setCaretPosition(htmlDoc.getLength());where output is the jtextpane.
My problem is that, if the user manually changes the position of the vertical scrollbar, after appending a new line in jtextpane, the above code will set the scrollbar at the bottom.
Is it possible to keep the scrollbar at the position it was before the new line has been appended (if the position of the scrollbar has been changed)?
Thanks in advance,
CharalamposStanislavL... with your suggestion the scroll bar will never scroll to the bottom.
I want to place the scroll bar at the bottom if it was at the bottom before I append text to jtextpane, otherwise I want to leave the scroll bar at the same position it was before I append the text. -
Af:table shows horizontal scroll when embedded in a region
I added a af:table in a jsff file which has 5 columns into a region. Even if the rows are empty, the horizontal bar is shown. I tried changing the width and/or styleClass attribute of the table and there is no change. I tried adding panelStrechLayout/panelCollection without any success.
Can you please let me know how to avoid the horizontal bar of the table.The contents of the jsff file is as follows and this jsff file is added as a region.
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:dvt="http://xmlns.oracle.com/dss/adf/faces">
<af:panelCollection id="pc1" featuresOff="wrap">
<af:table var="row" rowBandingInterval="0" id="sqlMon"
summary="SQL Monitor"
emptyText="No Data Found"
disableColumnReordering="true"
value="#{dbHomePageSQLMonitorBean.tableList}"
>
<af:column sortable="false" headerText="Duration" id="c5"
>
<af:spacer id="spr4" width="#{row.durationPX}" height="10px"
shortDesc="#{row.durationDesc}"
inlineStyle="background-color:Grey;"/>
</af:column>
<af:column sortable="false" headerText="SQL ID" id="c1"
noWrap="true" >
<af:outputText value="#{row.sql_id}" id="ot4"/>
</af:column>
<af:column sortable="false" headerText="Session" id="c4"
>
<af:outputText value="#{row.session_id}" id="ot1"/>
</af:column>
<af:column sortable="false" headerText="Parallel " id="c3"
noWrap="true">
<af:panelGroupLayout id="pgl1">
<af:image id="inst" source="/images/database/rac/dbcluster.gif"
shortDesc="Instance Count"/>
<af:outputText value="#{row.inst_count}" id="ot3"/>
<af:spacer width="10" />
<af:image id="nodes" source="/images/database/rac/dbcluster.gif"
shortDesc="Degree of parallelism"/>
<af:outputText value="#{row.dop}" id="ot31"/>
</af:panelGroupLayout>
</af:column>
<af:column sortable="false" headerText="Database Time" id="c2"
>
<af:panelGroupLayout id="mg1" >
<af:spacer id="spr1" width="#{row.cpuWidthPX}" height="10px"
shortDesc="#{row.cpuDesc}"
inlineStyle="background-color:Lime;"/>
<af:spacer id="spr2" width="#{row.userIOWidthPX}" height="10px"
shortDesc="#{row.userDesc}"
inlineStyle="background-color:Yellow;"/>
<af:spacer id="spr3" width="#{row.otherWidthPX}" height="10px"
shortDesc="#{row.otherDesc}"
inlineStyle="background-color:Orange;"/>
</af:panelGroupLayout>
</af:column>
</af:table>
</af:panelCollection>
</jsp:root> -
My horizontal scroll bar went missing when I maximise the window. How do I fix them?
My horizontal scroll bar went missing when I maximise the window. How do I fix them? I tried everything; such as auto hide the task bar. Even with this, I still can't see the horizontal scroll bar. I even tried the following and I still can't see the horizontal scroll bar.
1) In a new tab, type or paste about:config in the address bar and press Enter. Click the button promising to be careful.
(2) In the search box above the list, type or paste dom and pause while the list is filtered
(3) Double-click the dom.disable_window_open_feature.scrollbars preference to switch it from false to true. By choosing true, you disable sites from deciding whether there can be scrollbars on a window, and Firefox uses its standard behavior for the page.
If you want to always get other bars, here are the corresponding settings:
Menu Bar: dom.disable_window_open_feature.menubar
Navigation Toolbar: dom.disable_window_open_feature.toolbar
Bookmarks Toolbar: dom.disable_window_open_feature.personalbar
Please help.Can you post a screen shot?
Taking a Screen shot; '''''Windows > Start >''''' search box '''''> Snipping Tool'''''.
Save the picture(s) to your desktop. Now look at the '''Reply''' box below.
Do you see the button under it that says '''Browse'''? Click it and then select
the screen shot(s) from the desktop. -
Horizontal scrolling in a JTable with fixed-size columns
Hello,
I have come to a roadblock concerning the following issue. Perhaps someone can share their ideas...
I have a JTable with three fixed-size columns. I implemented a JScrollPane with vertical and horizontal scrolling. However, the text inserted into the last column is too long to fit in the specified column width. I would like to be able to scroll the table so that I can view all of the text in the last column. Right now, the text cuts off and ends with three dots (...). Is there a way in which a horizontal scroll bar can be implemented to view all the text in the last column?
Here is a portion of my code:
num_of_rows_Table2 = (int) Math.pow(3, num_of_vars);
String[] colunmNames_Table2 = {"Decimal Identifier", "Ternary Identifier", "Cancellation of nonimplicants"};
dataModel2 = new DefaultTableModel(colunmNames_Table2, num_of_rows_Table2);
SpaceOfTermsTable = new JTable(dataModel2);
for (int z = 0; z < num_of_rows_Table2; z++)
SpaceOfTermsTable.setRowHeight(z, row_height);
SpaceOfTermsTable.setBounds(new Rectangle(x1_Table2, y1_Table2, width_of_pane2, height_pane2));
SpaceOfTermsTable.getTableHeader().setReorderingAllowed(false);
for (int i = 0; i < 2; i++)
TableColumn col = SpaceOfTermsTable.getColumnModel().getColumn(i);
col.setMinWidth(colwidth_Table2);
col.setMaxWidth(colwidth_Table2);
col.setPreferredWidth(colwidth_Table2);
TableColumn lastcol = SpaceOfTermsTable.getColumnModel().getColumn(2); lastcol.setMinWidth(lastcol_Table2);
lastcol.setMaxWidth(lastcol_Table2);
lastcol.setPreferredWidth(lastcol_Table2);
SpaceOfTermsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
scrollPanel2 = new JScrollPane(SpaceOfTermsTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPanel2.setAutoscrolls(true);
scrollPanel2.setBounds(new Rectangle(x1_Table2, y1_Table2, width_of_pane2, height_pane2));
Thanks in advance for all of the help!Hi, I hava a similar problem than yours - can you tell me how you sorted out yer's?
-
WAD - how to get fixed display of colums when horizontal scrolling
Hi All,
Is it possible in the Web Application Designer to have the first 2 or 3 columns at a fixed position (meaning no horizontal scroll) while the other columns (next to them) will scroll horizontaly (using the horizontal scroll bar). Like the 'protect' function as you have in Excel.
Best regards,
JoshDear Josh,
basicly there a to options to achieve scrolling with fixed cells:
1. BW Standard Scrolling
Use Scrolling function of the Web Template Item, it
create icon below the table
2. Use CSS based scroll feature
like: http://www.imaputz.com/cssStuff/bigFourVersion.html
search google for "css table scroll"
Regards Marcus -
No horizontal scroll bar on the tJable.
In order to see long cell data we have to eliminate other columns of the table.
I need an horizontal scroll bar on the JTable if the data in a cell is longer.
Could somebody help me out?
Thanks in advance.in the jtable use following method :
myTable.setAutoResizeMode(this.AUTO_RESIZE_OFF);
KR,
Jan -
Horizontal scroll bar is in JTable
I am doing following code to set horizontal and vertical scroll bar to Table. vertical is working nicely but horizontal is not added to table and all colum of table got shrink and hardly visible. so i want to set horizontal scrollbar as needed.
how can that possible. looking for response
mTable.setPreferredScrollableViewportSize(new Dimension(TABLE_WIDTH, TABLE_HEIGHT));
mTable.setRowHeight(TABLE_ROW, TABLE_ROWHEIGHT);
mTable.getTableHeader().setResizingAllowed(false);
mTable.setGridColor(Color.darkGray);
mTable.getTableHeader().setReorderingAllowed(false);
mScrollPane = new JScrollPane(mTable);
mScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
mScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
Message was edited by:
Prashant_SDNthat looks odd. what is wrong in this case
Nothing's wrong. The columns all start up with the same default width.
If you want it fitted to width on being shown and then become adjustable then you should invoke that change in a listener which executes when the component is shown (the reliable way to do this is use a HierarchyListener which checks isShowing() and then executes if that's true, then deregisters itself). -
Hello!
I have a JTable inside a JScrollPane when the table has horizontal scroll it looks strange. When the user clicks in arrows of horizontal scroll the headers of table don't follow the scroll.
What am I doing wrong?
Thanks,
PatiThat's my code
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class Teste extends JFrame{
public Teste()
this.setSize(320,270);
JTable table = new JTable(10,15);
JScrollPane scroll = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
table.getColumnModel().getColumn(0).setPreferredWidth(150);
table.getTableHeader().setPreferredSize(new Dimension(150,15));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
scroll.setBounds(10,10,300,250);
this.getContentPane().add(scroll);
this.setVisible(true);
public static void main(String args[]){
Teste obj = new Teste();
The problem is in line:
table.getTableHeader().setPreferredSize(new Dimension(150,15));
When I remove it, the table works well. -
Horizontal scroll Bars not coming in JTable
Hi,
If a user streches any column of the jtable to the right such that its values are not visible properly. Then should the horizontal scroll bar come in the scrollpane in which table is there.??
If Yes then how can I do it?
I have seen when no of rows becomes more than the display area of the table then vertical scrollbar are coming automatically. but not Horizontal scroll bars.
Please helpsorry for my previous mistype, here is the right solutions to your problem.
As default the JTable will auto resize your column width, if you want horizon scrollbar
you must do following below steps:
JTable tableview = new JTable (model) ;
tableview.setAutoResizeMode (JTable.AUTO_RESIZE_OFF) ;
JScrollPane scrollpane = new JScrollPane (tableview,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED) ;
JPanel p ;
p.add (scrollpane) ;
This can works for you ! -
Wrapping photos in finder so no need to horizontal scroll
Hi, is there a way to have photos in finder wrap when they are big and not have to scroll left and right? I have a 13 inch and like to have big photos in finder to move around/copy paste but if they are big then i can't see them all when horizontal scrolling. is there a setting to change this?
thanks!
JamieIt could be photos, files, folders, whatever you are viewing in the large view (far left option of view--not file or list view, but large folder/file/photo view). If I have say 100 items in a finder window i'd like to see them all in one window and just scroll down. but as of now, when i make items bigger often i need to scroll left and right to see them as well. So I'd like to find out how to wrap all files/photos/whatever in a window so I can see them all--no matter how big my finder window is. sometimes my finder window is very small so i can move things between windows in various locaitons. I need to go up and down to find things but it's a super big pain to have to scroll left and right or make that window bigger just to fit, or to make the photos smaller to fit the window. see if you get what i mean. open a finder window small with a lot of photos or even folders in there. put it in big view and see if you get it.
sorry for long email.
thanks much!
Jamie -
Workaround for ComboBox Horizontal Scrolling Needed
Hi ,
I have a combobox which contains very long strings.(actually 3 strings(name of size 10 chars,type of size 10 chars, and 3rd string containing a list of abt 60 numbers)
But on selection, the width becomes too much and goes out of the screen.
I dont want to set max width becoz there is a requirement for the user to be able to see the contents of the whole string.
I learnt that there is no Horizontal scrolling option for the dropdown of the combobox.
So i'd like to know if the following is possible.
display only the
name and type in the dropdown. and when the mouse is hovered over a particular item, show a vertical list of 60numbers corresponding to the item being currently hovered.
is such a thing possible? or can u suggest a better workaround?
one option is to select an item from the dropdownlist and then use alert.show() to show the list of all numbers. but tat seems very crude way of doin it.
Thanks.This code works fairly well using an itemRenderer, though you may need to tweak it for your situation.
If this post answers your question or helps, please mark it as such.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable] private var ac:ArrayCollection = new ArrayCollection([
{name: "Test Name One", type: "Test Type One", numbers: "2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120"},
{name: "Test Name Two", type: "Test Type Two", numbers: "5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295, 300"},
{name: "Test Name Three", type: "Test Type Three", numbers: "100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300, 4400, 4500, 4600, 4700, 4800, 4900, 5000, 5100, 5200, 5300, 5400, 5500, 5600, 5700, 5800, 5900, 6000"},
private function createLabel(data:Object):String{
return data.name + " : " + data.type;
]]>
</mx:Script>
<mx:ComboBox id="cbx" dataProvider="{ac}" labelFunction="createLabel"
width="400">
<mx:itemRenderer>
<mx:Component>
<mx:VBox>
<mx:Text text="{data.name + ' : ' + data.type}"/>
<mx:TextArea text="{data.numbers}"
width="{outerDocument.cbx.width-20}"
height="100"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:ComboBox>
</mx:Application> -
Frequently when I use a touchpad or tilt wheel mouse to scroll horizontally, the web page does not scroll at all. Instead, the text cursor moves left or right. If the text box is off-screen, the page will jump to it, losing the spot on the page I was reading. This happens way too often given the sensitivity of touchpads and tilt wheel mice.
I'd like to just disable the cursor movement function of the horizontal scroll. I don't feel that it is useful and it actually hurts my web browsing experience. I do not want to disable horizontal scrolling though; I just want it to always scroll horizontally and do nothing else.You would make this a little easier if you posted a link to the page.
Most of the jump seems to be some extra padding or margin between the tabs when you rollover, but I am not able to find it. Is there any other css that is governing this page? I did remove a couple of <p></p> set of tags you had and it improved the jump, but it is still there.
If the page is live, run it through the validator http://validator.w3.org/ , fix whatever errors it finds, if you still have the jump, post a link to the page and the issue might get found.
Gary -
How can I get the panelTabbed to have a scroll bar when needed?
I have a panelTabbed with4 tabs and I want a scrollbar to appear when I shrink the size of the page down. I discovered that the tabs dissappear and there is not way to access them during some accessibility testing.
I tried inserting a panelGrouLayout around the paf:panelTabbed, but it did not help
<af:panelHeader id="ph3" text="#{acrResBundle['Header.Reports']}">
<af:panelGroupLayout id="pgl1" layout="scroll">
<af:panelTabbed id="panelTabbed1" styleClass="AFStretchWidth"
childCreation="lazy" inlineStyle="height:410px">
<af:showDetailItem disclosed="true" id="showDetailItem1"
stretchChildren="first"
text="#{resBundle['Header.TopPredictors']}">
<af:panelGroupLayout id="pgl3" layout="scroll">
<af:region id="TopDr1"
value="#{bindings.TopDriversRegion1.regionModel}"/>
</af:panelGroupLayout>
</af:showDetailItem>
Also, the outer page, which uses fnd:applicationsPanel with scroll="true", that the above is embedded in does get a scroll bar when needed by other af:panelHeader sections of the page.Looks like the problem only occurs in screenReader mode, i.e., the ">>" link does not show up at all in screenReader mode, but does show up when not using screenReader mode. I filed bug 10407797
Edited by: klaus gross on Dec 16, 2010 3:21 PM
Maybe you are looking for
-
My left arrow does not work on my macbook pro(model A1226). I have reset nvram, performed a safe boot, pulled the cache to desktop, replaced .globalpreference.plist, & tested all other keys with "keyboard viewer" (all other keys work except for the a
-
DWCS3 & PHP / MySQL Can a PHP form be used for two events? Example have the user type their user name to retrieve their information. The make any changes to their personal data, and update the database with that information. I'm thinking two buttons
-
Erroring with: REP-0178: Cannot connect to Reports Server
When trying to run the rwclient60 at Unix Command, shows the error. Is report server name is given wrong or having issue in connecting to the report server. Please do let me know. Thanks a lot for the support.
-
Reservation line item missing upon posting
Dear SAP gurus and expert, Currently there is one Reservation with 89 line item, there are about 20 line items already posted goods issue. and the remaining is yet to be posted. The movement type of the SR is 201, so the SR is being posted in MIIGO.
-
Hi, I am working on an ADF/JSF application using WebLogic server. When I run a jsfx page to test, the browser displays a blank page. Even the splash screen is not shown and i get no error. Do you have any solutions?