Jscrollbar scrollbar not painting
I have a jscrollpanel and whenever I populate the panel, the jscrollbar actual scrollbars do not paint until i hover my mouse over them. How would I make it repaint automatically?
Read the tutorials for working examples.
If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
Similar Messages
-
JScrollbar not painting scrollbars until mouseover?
I have a jscrollpane that has a jtable attached to it, it paints the table just fine, but the jscrollbars do not appear until I mouseover the place where the scrollbar should be. Is there a method I should call that would call the elements of the scrollbar itself? Thanks and happy new year
Why don't you actually read the reply. Apparently the 70 other people who read your question thought it was a good answer since they had nothing to add.
It works for everybody else in the forum so all you should need to do is read the tutorial for a working example and then compare your code to see whats different.
We can't guess why it works for everybody else in the forum and not you. Apparently you are writing some wierd code. You where then asked to post a SSCCE, because we are not mind readers and can't guess what your code looks like.
I suspect you won't be getting any further help with this question. Maybe you will learn how to post a proper question the next time. And you might learn how not to piss off the only persion who even made an attempt to help solve your problem over the last 5 days. -
Scrollbar not working in a JScrollPane
In the JDialog there is a JScrollPane. JTextPane is in a the scroll pane. For some reason the scrollbars are not working.
Any suggestions on this why the scrollbars not working?
Thanks.using the setText() method the text is set to the text pane from some other package. the Dialog displays the text too with the vertical scroll bar that doesn't work.
public MyDialog(JFrame frame) {
super(frame);
initialize();
private void initialize() {
this.setResizable(true);
this.setName("");
this.setUndecorated(false);
this.setContentPane(getScrl());
this.setSize(400, 300);
this.centerDialog();
private javax.swing.JScrollPane getScrl() {
if (scrl == null) {
scrl = new javax.swing.JScrollPane();
scrl.setViewportView(getTxt());
return scrl;
private javax.swing.JTextPane getTxt() {
if (txt == null) {
txt = new javax.swing.JTextPane();
txt.setBackground(java.awt.SystemColor.info);
txt.setEditable(false);
return txt;
public void setText(String text) {
if (txt.getEditorKit() == null) {
txtToolTip.setEditorKit(new StyledEditorKit());
txt.setContentType("text/html");
txt.setOpaque(true);
txt.setText(text); -
Vertical scrollbar not showing all the records when I scroll down.
Vertical scrollbar not showing all the records when I scroll down.
Using Oracle forms 10g , operating system windows
I have two fields with number of items dispayed = 15.
I have a vertical scroll bar with them. There are 34 records in the table but the scrollbar only shows 15 records.
Here are the properties for block / scrollbar.
WORK_CATEGORY
- Subclass Information
- Comments
* Navigation Style Same Record
- Previous Navigation Data Block
- Next Navigation Data Block
- Current Record Visual Attribute Group
- Query Array Size 0
- Number of Records Buffered 0
* Number of Records Displayed 60
* Query All Records No
- Record Orientation Vertical
* Single Record No
- Database Data Block Yes
- Enforce Primary Key No
- Query Allowed Yes
- Query Data Source Type Table
* Query Data Source Name WORK_CATEGORY
* Query Data Source Columns
* Column Name JOB_TYPE
* Column Type VARCHAR2
- Column Type Name
- Parent Column
* Length 30
* Precision 0
* Scale 0
* Mandatory Yes
* Column Name WORK_CATEGORY
* Column Type VARCHAR2
- Column Type Name
- Parent Column
* Length 30
* Precision 0
* Scale 0
* Mandatory Yes
- Query Data Source Arguments
- Alias
- Include REF Item No
* WHERE Clause
* ORDER BY Clause job_type
- Optimizer Hint
- Insert Allowed Yes
- Update Allowed Yes
- Locking Mode Automatic
- Delete Allowed Yes
- Key Mode Automatic
- Update Changed Columns Only No
- Enforce Column Security No
- Maximum Query Time 0
* Maximum Records Fetched 0
- DML Data Target Type Table
- DML Data Target Name
- Insert Procedure Name
- Insert Procedure Result Set Columns
- Insert Procedure Arguments
- Update Procedure Name
- Update Procedure Result Set Columns
- Update Procedure Arguments
Don't know where am I going wrong. I'll really appreciate if you can help me in this.
Thanks.
Edited by: 831050 on Sep 14, 2011 8:05 AMOne of the items is a list item.. here are it's properties:
* Name JOB_TYPE
* Item Type List Item
- Subclass Information
- Comments
- Help Book Topic
- Enabled Yes
* Elements in List
* Label
* List Item Value LIST20
* List Style Combo Box
- Mapping of Other Values
- Implementation Class
- Case Restriction Mixed
- Popup Menu
- Keyboard Navigable Yes
- Mouse Navigate Yes
- Previous Navigation Item
- Next Navigation Item
- Data Type Char
- Data Length Semantics Null
- Maximum Length 30
- Initial Value
* Required Yes
* Copy Value from Item
- Synchronize with Item
- Calculation Mode None
- Formula
- Summary Function None
- Summarized Block
- Summarized Item
- Current Record Visual Attribute Group
- Distance Between Records 0
* Number of Items Displayed 15
- Database Item Yes
* Column Name JOB_TYPE
- Primary Key No
- Query Only No
- Query Allowed Yes
- Insert Allowed Yes
- Update Allowed Yes
- Update Only if NULL No
- Visible Yes
* Canvas CANVAS2
- Tab Page
* X Position 47
* Y Position 137
* Width 187
* Height 18
- Visual Attribute Group DEFAULT
- Prompt Visual Attribute Group DEFAULT
- Foreground Color
* Background Color white
- Fill Pattern
- Font
* Font Name Tahoma
* Font Size 10
* Font Weight Demilight
* Font Style Plain
* Font Spacing Normal
* Prompt Job Type
- Prompt Display Style First Record
* Prompt Justification Start
* Prompt Attachment Edge Top
- Prompt Alignment Start
* Prompt Attachment Offset 10
* Prompt Alignment Offset 0
- Prompt Reading Order Default
- Prompt Foreground Color
- Prompt Font
* Prompt Font Name Tahoma
* Prompt Font Size 10
* Prompt Font Weight Bold
* Prompt Font Style Plain
* Prompt Font Spacing Normal
- Hint
- Display Hint Automatically No
- Tooltip
- Tooltip Visual Attribute Group
- Direction Default
- Initial Keyboard State Default
- Keyboard State Any
-
If I use "Windows 7 Basic" theme on my laptop (Fujitsu Lifebook A532), the Firefox window is not painted.
I see only the border of the window, the content not. As soon as I switch back to the "Windows 7" theme,
it works again.
It could be related to the graphics driver (from Intel) of my new laptop.
Before I had a desktop computer, and did not have this problem.
Update: the problem occurs only if I use my port replicator (Fujitsu USB Port Replicator PR07).
If I unplug the replicator, and use only the monitor of my laptop, everything is fine.''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''Please create a screenshot of the problem you're seeing by following the guide mentioned at [[How do I create a screenshot of my problem?]].
Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem. -
ScrollBars not showing up properly
I am displaying a JTree in a JScrollPane with default settings ie. both horizontal and vertical scroll bars will show up when the contents can not fit in to the scroll pane.In this case when i expand the tree nodes the scroll bars are not showing up properly.It looks like the foreground is not painted properly.The background color is white here.We are using custom look and feel, not the standard one. Any idea why it is so?
Thanx in advance
AshokThis is the MetalTheme i am using.
public class SSBCMetalTheme extends javax.swing.plaf.metal.MetalTheme
// private final ColorUIResource primary1 = new ColorUIResource(102,102,153);
private final ColorUIResource primary1 = new ColorUIResource(0,0,0);
// private final ColorUIResource primary2 = new ColorUIResource(153,153,204);
private final ColorUIResource primary2 = new ColorUIResource(153,153,153);
// private final ColorUIResource primary3 = new ColorUIResource(204,204,255);
private final ColorUIResource primary3 = new ColorUIResource(204,204,204);
private final ColorUIResource windowBackground = new ColorUIResource(Color.white);
private final ColorUIResource textHighlight = new ColorUIResource(Color.blue);
private final ColorUIResource secondary1 = new ColorUIResource(102,102,102);
private final ColorUIResource secondary2 = new ColorUIResource(153,153,153);
private final ColorUIResource secondary3 = new ColorUIResource(204,204,204);
// private FontUIResource controlFont = new FontUIResource("Dialog",Font.BOLD,12);
private FontUIResource controlFont = new FontUIResource("Dialog",Font.BOLD,11);
// private FontUIResource systemFont = new FontUIResource("Dialog",Font.PLAIN,12);
private FontUIResource systemFont = new FontUIResource("Dialog",Font.PLAIN,11);
// private FontUIResource userFont = new FontUIResource("Dialog",Font.PLAIN,12);
private FontUIResource userFont = new FontUIResource("Dialog",Font.PLAIN,11);
private FontUIResource smallFont = new FontUIResource("Dialog",Font.PLAIN,10);
public String getName() { return "SSBC"; }
protected ColorUIResource getPrimary1() { return primary1; }
protected ColorUIResource getPrimary2() { return primary2; }
protected ColorUIResource getPrimary3() { return primary3; }
protected ColorUIResource getSecondary1() { return secondary1; }
protected ColorUIResource getSecondary2() { return secondary2; }
protected ColorUIResource getSecondary3() { return secondary3; }
//public ColorUIResource getWindowBackground() { return (primary3); };
public ColorUIResource getWindowBackground() { return windowBackground; };
public ColorUIResource getDesktopColor() { return (primary3); };
public ColorUIResource getTextHighlightColor(){ return primary3;}
//public ColorUIResource getControlDisabled(){ return primary3;}
//public ColorUIResource getControlHighlight(){ return windowBackground;}
public FontUIResource getControlTextFont() { return controlFont;}
public FontUIResource getSystemTextFont() { return systemFont;}
public FontUIResource getUserTextFont() { return userFont;}
public FontUIResource getMenuTextFont() { return controlFont;}
public FontUIResource getWindowTitleFont() { return controlFont;}
public FontUIResource getSubTextFont() { return smallFont;}
I can't use windows look and feel as i am using the above look and feel.Any idea what is the problem?
Thanx
Ashok -
Block's Scrollbar Not Scrolling
Hi,
I have a multi-record block that has a scrollbar and contain some fields that I disable or enable according to some business rules.
It seems that this enabling/disabling is causing the scrollbar not to scroll up and down through records in the block for some reason; what I mean is that if the cursor was in another block, and I tried to scroll up/down in the original block using the scrollbar, the scrollbar "position" seems to change but the records in the list don't scroll up/down! the scrollbar works only if the cursor was in the block before using the scrollbar.
I hope the problem description was clear and that I hear from you soon.
Regards,
SamirHi
Whenever u enable any of the item in the multirecord block then this happens try to have it as a display item -
JFrame Not Painting Until Resize
I have a couple of components in my JFrame. At first, it looks like the JFrame's not painting. I tried calling repaint() before and after I made the JFrame visible. I also moved the JFrame, which should repaint it. However, if I try to resize the JFrame or just click while the cursor is in "resize mode," everything draws and acts fine. Unfortunately, I want to make the JFrame non-resizable. What's the problem?
try calling the validate method before repainting
-
JScrollBar thumb not appearing
Hi guys I have this problem where there's a JScrollPane that contains a JPanel that is definitely larger (taller but not wider). The VScrolBar appears but the thumb isn't drawn. There was a time when it did draw but I must have made a change and it doesn't appear anymore.
Here's the code that initialises it:
private void createComponents() {
CPcontainer = new JPanel();
int paneHeight = ComponentPane.getSizeForComponent(Name);
int noOfComponents = commonValues.length;
CPcontainer.setLayout(null);
CPcontainer.setBackground(Main.background);
componentPane = new ComponentPane[noOfComponents];
for(int i = 0; i < noOfComponents; i++) {
componentPane[i] = new ComponentPane(Main, i, nameVal);
CPcontainer.add(componentPane);
componentPane[i].setBounds(2, i*(paneHeight + 2) + 2, 143, paneHeight);
scrollPane = new JScrollPane(CPcontainer);
//scrollPane.setAutoscrolls(true);
scrollPane.setBorder(BorderFactory.createLineBorder(Main.foreground));
scrollPane.setLayout(new ScrollPaneLayout());
scrollPane.setWheelScrollingEnabled(true);
scrollPane.setDoubleBuffered(true);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
vScroll = scrollPane.getVerticalScrollBar();
vScroll.setUI(new LabScrollUI(scrollPane, Main));
vScroll.setVisible(true);
this.add(scrollPane);
CPcontainer.setBounds(0, titleOffset, 145, (paneHeight + 2)*noOfComponents + 2);
//CPcontainer.setPreferredSize(new Dimension(145, (paneHeight + 2)*noOfComponents + 1));
scrollPane.setBounds(0, titleOffset, 166, height - titleOffset);
Thanks in advance if anyone can helpThe scrollbars appear automatically when the "preferred size" of the component added to the scroll pane is greater than the size of the scroll pane.
If you use layout managers the preferred size is calculated automatically.
If you use a null layout or do custom painting you are responsible for determining the preferred size of the component. -
Scrollbars with painting - why this doesn't work properly ?
Hello I written such a small program:
/* Test.java */
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test extends JFrame {
private JPanel mainPanel;
private InnerPanel innerPanel; // Panel w/ JScrollPane
private JScrollPane scroll;
private JButton addItem;
public static final int WINDOW_WIDTH = 200;
public static final int WINDOW_HEIGHT = 200;
public Test () {
buildPanel();
add(mainPanel);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
setVisible(true);
public void buildPanel() {
mainPanel = new JPanel(new BorderLayout());
innerPanel = new InnerPanel();
scroll = new JScrollPane(innerPanel);
scroll.setPreferredSize(new Dimension(100, 100));
addItem = new JButton("Add an item to JPanel");
addItem.addActionListener(new ButtonListener());
mainPanel.add(scroll, BorderLayout.CENTER);
mainPanel.add(addItem, BorderLayout.PAGE_START);
private class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
innerPanel.increase();
innerPanel.revalidate();
scroll.revalidate();
scroll.getVerticalScrollBar().setValue(
(scroll.getVerticalScrollBar()).getMaximum());
public static void main(String[] args) {
Test test = new Test();
class InnerPanel extends JPanel {
int x0 = 50, y0 = 50, x1 = 100, y1 = 50;
public void paintComponent(Graphics g) {
g.drawLine(x0,y0,x1,y1);
public void increase() {
x1 += 50;
setPreferredSize(new Dimension(x1 + 100, y0));
repaint();
}I click for example 5 times on the button and then move the scroll max to the right.
The end of the line should be already visible, but it's not. However it will be,
when you resize the frame just a bit.
Now when I try to move scroll max to the left but the beginning of the line doesn't show up. However it will , when you resize the frame just a bit.
Can anybody point where I made a mistake ?Not sure I understand the description of the problem. I didn't notice any change in painting when I resized the frame, but anyway I made the following changes to help with the painting:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test6 extends JFrame {
private JPanel mainPanel;
private InnerPanel innerPanel; // Panel w/ JScrollPane
private JScrollPane scroll;
private JButton addItem;
public static final int WINDOW_WIDTH = 200;
public static final int WINDOW_HEIGHT = 200;
public Test6 () {
buildPanel();
getContentPane().add(mainPanel);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
setVisible(true);
public void buildPanel() {
mainPanel = new JPanel(new BorderLayout());
innerPanel = new InnerPanel();
scroll = new JScrollPane(innerPanel);
scroll.setPreferredSize(new Dimension(100, 100));
addItem = new JButton("Add an item to JPanel");
addItem.addActionListener(new ButtonListener());
mainPanel.add(scroll, BorderLayout.CENTER);
mainPanel.add(addItem, BorderLayout.PAGE_START);
private class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
innerPanel.increase();
// innerPanel.revalidate();
// scroll.revalidate();
scroll.getVerticalScrollBar().setValue(
(scroll.getVerticalScrollBar()).getMaximum());
public static void main(String[] args) {
Test6 test = new Test6();
class InnerPanel extends JPanel {
int x0 = 50, y0 = 50, x1 = 100, y1 = 50;
public void paintComponent(Graphics g) {
super.paintComponent(g); // added
g.drawLine(x0,y0,x1,y1);
public void increase() {
x1 += 50;
setPreferredSize(new Dimension(x1 + 100, y0));
revalidate(); // added
// repaint();
} -
DIV scrollbar not working in IE 6
Posted this yesterday with no response. Since then I've
discovered it seems to be an IE 6 problem. Suggestions?
Using a DIV tag set to overflow. I have it so the scroll bars
show up if more text is addded. Works fine on my three PC's with IE
and FF, but the client says it doesn't work on her 3 computers at
all (AOL, IE 6). I tested with IE 6 and she's right...the scrollbar
just doesn't move.
Here's the page:
http://www.starkovichreporting.com/default.htm
Here's the CSS:
http://www.starkovichreporting.com/stylesheets/styles.css
Suggestions?
-JesseI dont have an answer, but whenever I run into a problem that
cannot/does
not get answered here, I just google it..and I found this
http://www.gunlaug.no/contents/wd_additions_15.html
There were quite a few articles when I used the search scroll
bar ie6.
HTH
"JesseLY" <[email protected]> wrote in
message
news:gnhh44$3a8$[email protected]..
> Posted this yesterday with no response. Since then I've
discovered it
> seems to
> be an IE 6 problem. Suggestions?
>
> Using a DIV tag set to overflow. I have it so the scroll
bars show up if
> more
> text is addded. Works fine on my three PC's with IE and
FF, but the client
> says
> it doesn't work on her 3 computers at all (AOL, IE 6). I
tested with IE 6
> and
> she's right...the scrollbar just doesn't move.
>
> Here's the page:
http://www.starkovichreporting.com/default.htm
>
> Here's the CSS:
>
http://www.starkovichreporting.com/stylesheets/styles.css
>
> Suggestions?
>
> -Jesse
> -
Flex 4: Custom ScrollBar not working in Custom DropDownList
Hello,
I'm having an odd issue that I just cannot figure out. I have a custom DropDownList .as component (to pass color values) and a custom skin. In this skin I am using a custom Scroller (same AS file component with mxml skin). When I use this configuration, clicking on the scrollbar just closes the DropDown. If I remove the skin from my custom scrollbar it works, which leads me to believe it has something to do with the DropDown skin. Even if I revert my custom Scroller to the spark Scroller, it still doesn't work. I've narrowed it down to what seems like a problem with my DropDownList skin.
Not really sure what code to put here, but all I've been doing is right clicking my project and making new ActionScript components and MXML skins from the default skin. Here is my DropDownList skin, not sure if I should paste any other code? I have no idea what would be causing this, so I don't really know what code to place.
[HostComponent("ccm.DropDown.DropDownList")]Woops, the code didn't place correctly, here it is:
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fb="http://ns.adobe.com/flashbuilder/2009" alpha.disabled=".5" xmlns:Scroller="ccm.Scroller.*" xmlns:DropDown="ccm.DropDown.*">
<fx:Metadata>
[HostComponent("ccm.DropDown.DropDownList")]
</fx:Metadata>
<!-- host component -->
<fx:Script fb:purpose="styling">
<![CDATA[
import flash.filters.BitmapFilterQuality;
import flash.filters.BitmapFilterType;
import mx.controls.Alert;
import spark.filters.*;
/* Define the content fill items that should be colored by the "contentBackgroundColor" style. */
static private const contentFill:Array = [];
* @private
override public function get contentItems():Array {return contentFill};
* @private
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
openButton.setStyle("cornerRadius", getStyle("cornerRadius"));
super.updateDisplayList(unscaledWidth, unscaledHeight);
]]>
</fx:Script>
<s:states>
<s:State name="normal" />
<s:State name="open" />
<s:State name="disabled" />
</s:states>
<!---
The PopUpAnchor control that opens the drop-down list.
<p>In a custom skin class that uses transitions, set the
<code>itemDestructionPolicy</code> property to <code>none</code>.</p>
-->
<s:PopUpAnchor id="popUp" displayPopUp.normal="false" displayPopUp.open="true" includeIn="open"
left="0" right="0" top="0" bottom="0" itemDestructionPolicy="auto"
popUpPosition="below" popUpWidthMatchesAnchorWidth="true" >
<!---
This includes borders, background colors, scrollers, and filters.
@copy spark.components.supportClasses.DropDownListBase#dropDown
-->
<s:Group maxHeight="134" minHeight="22" >
<s:Rect id="fill" left="1" right="1" top="1" bottom="0" bottomLeftRadiusX="16.5" bottomRightRadiusX="16.5" topLeftRadiusX="16.5" topRightRadiusX="16.5" >
<s:fill>
<s:SolidColor color="0xFFFFFF" />
</s:fill>
<s:filters>
<s:GlowFilter
color="0x000000"
alpha=".35"
blurX="6"
blurY="6"
strength="1"
quality="{BitmapFilterQuality.HIGH}"
inner="true"
knockout="false"/>
</s:filters>
</s:Rect>
<!--- @private -->
<Scroller:Scroller id="scroller" left="8" top="8" right="8" bottom="8" hasFocusableChildren="false" minViewportInset="1"
showButtons="false"
trackColor="{hostComponent._trackColor}"
thumbColor="{hostComponent._thumbColor}"
skinClass="ccm.Scroller.ScrollerSkin">
<!--- @copy spark.components.SkinnableDataContainer#dataGroup-->
<s:DataGroup id="dataGroup" itemRenderer="ccm.DropDown.DropDownItemRenderer">
<s:layout>
<s:VerticalLayout gap="0" horizontalAlign="contentJustify"/>
</s:layout>
</s:DataGroup>
</Scroller:Scroller>
</s:Group>
</s:PopUpAnchor>
<!--- The default skin is DropDownListButtonSkin.
@copy spark.components.supportClasses.DropDownListBase#openButton
@see spark.skins.spark.DropDownListButtonSkin -->
<DropDown:DropDownButton id="openButton" left="0" right="0" top="0" bottom="0" focusEnabled="false"
skinClass="ccm.DropDown.DropDownButtonSkin"
buttonColor="{hostComponent._buttonColor}"
/>
<!--- @copy spark.components.DropDownList#labelDisplay -->
<s:Label id="labelDisplay" verticalAlign="middle" maxDisplayedLines="1"
mouseEnabled="false" mouseChildren="false"
left="12" right="30" top="2" bottom="2" width="75" verticalCenter="1" />
</s:SparkSkin> -
Non-modal JDialog is not painted and blocks the GUI
I have developed a GUI that's basically a JFrame with a JDesktopPane.
The user can, via a menu item, pop up a JDialog that contains some JLists and then select some value from it. Once he/she has done the selection and clicks on OK, the dialog disappears (data processing is then done in the main GUI) and comes back once a specific event has happened. The user then selects other data and so on, until he/she clicks on Cancel, which definitely disposes of the JDialog.
The graphics of the JDialog are build in the class constructor, which does a pack() but does not make the dialog visible yet. The dialog appears only when doSelection() is called.
/** Called the first time when user selects the menu item, and then
when a specific event has happened. */
public Data[] doSelection() {
dialog.setVisible(true);
// ... Code that reacts to user's input. Basically, the ActionListener
// added to the buttons retrieves the user's selection and calls
// dialog.setVisible(false) if OK is clicked, or calls dialog.dispose()
// if Cancel is clicked.
}Now, everything works fine if the JDialog is modal, but if I make it non-modal only the window decorations of the JDialog are painted, and the control doesn't return to the main GUI. Calling doLayout() or repaint() on the doSelection() has no effect. How can this be fixed?
I hope I have been able to explain the problem satisfactorily, I could not create a suitable SSCCEE to show you. Thanks in advance for any hint.Ok, I've taken some time to think about this problem and I've modified the code a bit.
Now the dialog shows itself and is responsive (i.e. its JLists can be operated), but the Ok button does not close the dialog as I'd want. I believe that I'm messing up things about threading, and the operations in actionPerformed() should be carried out in another thread, if possible.
Thanks in advance for any hint / suggestion / comment / insult.
private Data[] selection;
/** Constructor */
public MyDialog() {
// ... Here is the code that builds the dialog...
dialog.setModal(false);
dialog.pack();
// Note that the dialog is not visible yet
public Data[] doSelection() {
operatorAnswer = NONE_YET;
dialog.setVisible(true);
while (operatorAnswer == NONE_YET) {
try {
wait();
} catch (InterruptedException e) { }
return (operatorAnswer == OK ? selection : null);
public void actionPerformed(ActionEvent evt) {
if (okButton.equals(evt.getSource())) {
operatorAnswer = OK;
retrieveSelection();
dialog.setVisible(false);
else if (cancelButton.equals(evt.getSource())) {
operatorAnswer = CANCEL;
dialog.dispose();
private void retrieveSelection() {
// ... Here is the code that retrieves selected data from the dialog's JLists
// and stores it in the "selection" private array...
notifyAll();
} -
JOptionPane not painting correctly in JApplet.
Having a JOptionPane painting problem in my JApplet.
applet has a JFrame, that is the "main" container.
Main frame is already shown. USer clicks a button, and all I'm trying to do is show a simple JOptionPane.
SPecifically trying to call JOptionPane.showMessageDialog(null, "test message");
Note the button that generates the event, is on a Panel, within the JFrame.
I've tried just about everyting I can think of. SwingUtilites.invokeLater ... setting the null to JFrame, applet... and just about everything else...
JOptionPane does pop up, but the background of the Pane never paints correctly... I've used 1.3.1_04, and 1.4 .. plugins...
Now at a lost... Read all the newsgroups... and forums..
But I'm missing somehting?
Thanks in advace...
EB.check what is in ur paint(Graphic g) method. if it does nothing, remove the paint(Graphic g) method. if it has some codes, double check ur codes.
-
Hi all, my issue that I've been facing using Itunes 7 is the scrollbars on my mouse quit working, are any of you having this problem? Any fixes people have come across? Thanks.
-DS
David
Custom AMD 64 3200 Windows XP ProIs your MacBook one with an easily removeable battery? Some of the batteries have been known to expand and interfere with the trackpad. Test by the following steps:
Shut down your MacBook.
Remove the battery.
Connect to power adapter.
Start up the MacBook.
Test the trackpad.
Examine the battery for expansion.
If the battery has expanded, do not use it again. Replace it.
Best of luck.
Maybe you are looking for
-
When will there be an update for Logic Pro X?
So many bugs. Problems with installing. Where does it stop? Does anyone know of a date when it will be updated to correct serious issues? I am resorting to using Reason on my PC. Maybe they should stop building that huge corporate HQ in Cupertino and
-
Out.print() error
Hi am working on a jsp page which when ran gives an error: "An error occurred at line: 58 in the jsp file: /BPMProcess.jsp out cannot be resolved" What could be the problem. I am s newbie. :) thanks <%@ page language="java" import="com.metastorm.ewor
-
DMS_RELOCATE_CONTENT take more documents you whant!
Hi at all, i just whant to inform you about an "Error" i get last week. I moved DMS Documents from Categorie X to Y with the standard Report DMS_RELOCATE_CONTENT. I just select the source Category (s_scat) and the If the X repository is not assigned
-
[solved] How can I re-map my keyboard?
I want to make some very specific changes to my keyboard layout in Arch, but I have no idea where to start. I'm going to switch my Alt and Control keys (I'm a Mac guy, and I'm used to the Control/Apple key being where the Alt is), activate my Page-Le
-
Getting error while doing stream setup through OEM
hi all, I am getting following error while doing stream setup for user stradmin (ORCL) db to stradmin_dest (orcldestination) on same windows m/c. java.sql.SQLException: ORA-20204: User does not exist: STRADMIN ORA-06512: at "SYSMAN.MGMT_USER", line 1