How to control the maximum size of a component in a GridBagLayout
Here is a small program that demonstrates my issue (it's originally from a big program that I couldn't attach here).
I have a GridBagLayout with some components in it. Some of the components are JEditorPane (displaying some HTML) within JPanel and are individally scrollable.
Here we go:
- when I resize the main panel, every components will resize accordingly to their weight (which is here the same for all of them): fine
- when I reduce the size of the main panel until it reaches all the preferred size of each component, the scrollPane of the main panel appears so that the user can scroll: not fine
The behaviour I'm looking for is: when I reduce the size of the main panel, when it reaches the preferred size of the components, I would like that the JEditorPane (which are in JPanel with BorderLayout/CENTER) display their individual scrollbars so that I can see all the JEditor panes at the same time without having to scroll the main window.
If the user continues to reduce the size of the main panel, then, at one point, display the scrollpane of the main panel.
See what I mean? How to control this?
Here is the code:
@SuppressWarnings("serial")
public final class CGridBagLayout2 extends JFrame {
JPanel mainPanel;
private final JScrollPane scrollPane;
private JPanel panelize(Component component, String localization) {
JPanel output = new JPanel(new BorderLayout());
output.add(component, localization);
return output;
public void addComponentsToMainPanel() {
mainPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.weightx = 1.0;
c.fill = GridBagConstraints.BOTH;
String TEST_BIGTEXT = "<html><body><h2>Path</h2>toto/tutu/tata/TestN<h2>Prerequisites</h2>blah blah blah blah<br/><b>blah blah</b> blah blah\nblah blah <u>blah</u> blahblah blah blah<h2>Description</h2>blah blah blah blah<br/><b>blah blah</b> blah blah\nblah blah <u>blah</u> blahblah blah blah blah\nblah blah blah <br/>lah blah blah <br/>lah blah blah blah blah blah blah blah FIN</body></html>";
for (int index=0; index<10; index++) {
c.gridheight = 5; // nb Testcases for this test
c.anchor = GridBagConstraints.FIRST_LINE_START; // align all the components top-left aligned
c.gridy = index;
JLabel a = new JLabel("AAAAA");
c.gridx = 0;
mainPanel.add(panelize(a, BorderLayout.NORTH), c);
JLabel b = new JLabel("BBBBB");
c.gridx = 1;
mainPanel.add(panelize(b, BorderLayout.NORTH), c);
JEditorPane d = new JEditorPane("text/html", TEST_BIGTEXT);
c.gridx = 2;
mainPanel.add(panelize(d, BorderLayout.CENTER), c);
JEditorPane e = new JEditorPane("text/html", TEST_BIGTEXT);
c.gridx = 3;
mainPanel.add(panelize(e, BorderLayout.CENTER), c);
index++;
public CGridBagLayout2() {
super("GridBagLayout");
mainPanel = new JPanel();
addComponentsToMainPanel();
scrollPane = new JScrollPane(mainPanel);
setContentPane(scrollPane);
public static void main(String[] args) {
Frame frame;
WindowListener exitListener;
exitListener = new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Window window = e.getWindow();
window.setVisible(false);
window.dispose();
System.exit(0);
frame = new CGridBagLayout2();
frame.addWindowListener(exitListener);
frame.setPreferredSize(new Dimension(1000, 800));
frame.pack();
frame.setVisible(true);
}Many thanks in advance, I'm getting crazy on this one :)
Ok, thanks for this information, I thought I had seen this happening in the past when embedding a component in the center area of a JPanel with BorderLayout.
Anyway, as I said I tested with JScrollPane as well and it does not change anything.
Here is the code modified:
@SuppressWarnings("serial")
public final class CGridBagLayout2 extends JFrame {
JPanel mainPanel;
private final JScrollPane scrollPane;
private JPanel panelize(Component component, String localization) {
JPanel output = new JPanel(new BorderLayout());
output.add(component, localization);
return output;
public void addComponentsToMainPanel() {
mainPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.weightx = 1.0;
c.fill = GridBagConstraints.BOTH;
String TEST_BIGTEXT = "<html><body><h2>Path</h2>toto/tutu/tata/TestN<h2>Prerequisites</h2>blah blah blah blah<br/><b>blah blah</b> blah blah\nblah blah <u>blah</u> blahblah blah blah<h2>Description</h2>blah blah blah blah<br/><b>blah blah</b> blah blah\nblah blah <u>blah</u> blahblah blah blah blah\nblah blah blah <br/>lah blah blah <br/>lah blah blah blah blah blah blah blah FIN</body></html>";
for (int index=0; index<10; index++) {
c.gridheight = 5; // nb Testcases for this test
c.anchor = GridBagConstraints.FIRST_LINE_START; // align all the components top-left aligned
c.gridy = index;
JLabel a = new JLabel("AAAAA");
c.gridx = 0;
mainPanel.add(panelize(a, BorderLayout.NORTH), c);
JLabel b = new JLabel("BBBBB");
c.gridx = 1;
mainPanel.add(panelize(b, BorderLayout.NORTH), c);
JEditorPane d = new JEditorPane("text/html", TEST_BIGTEXT);
c.gridx = 2;
mainPanel.add(panelize(new JScrollPane(d), BorderLayout.CENTER), c);
JEditorPane e = new JEditorPane("text/html", TEST_BIGTEXT);
c.gridx = 3;
mainPanel.add(panelize(new JScrollPane(e), BorderLayout.CENTER), c);
public CGridBagLayout2() {
super("GridBagLayout");
mainPanel = new JPanel();
addComponentsToMainPanel();
scrollPane = new JScrollPane(mainPanel);
setContentPane(scrollPane);
public static void main(String[] args) {
Frame frame;
WindowListener exitListener;
exitListener = new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Window window = e.getWindow();
window.setVisible(false);
window.dispose();
System.exit(0);
frame = new CGridBagLayout2();
frame.addWindowListener(exitListener);
frame.setPreferredSize(new Dimension(1000, 800));
frame.pack();
frame.setVisible(true);
}Edited by: eric_gavaldo on Sep 15, 2010 2:18 PM
Similar Messages
-
How to determine the maximum size of JFrame?
I am using JDK1.2 to develop an application. I have
a problem to handle the maximum size of of JFrame.
If the user clicks the maximum icon or double-clicks
the title bar from the JFrame, the JFrame becomes
maximum. How can I determine the state of maximization? I need to bring different views if the
JFrame is maximum or minimum. I knew JDK1.4 can
handle this problem. Or using JNI, either. Does
anyone know other ways to handle this?
Thanks,
PeterSo that you won't have to wait forever:
Sorry, pal, the only way is JNI. I researched this earlier for 1.2, but can't find it right now in the database. They finally added it to 1.4.
Good luck. -
How to control the pixcel size in given tiff image
Hai
I loaded tiff image into the Frame by using the jai_core.jar and jai_codec.jar files. I am unable to control the pixcel size. It displaied default size. How to restract the pixcel on the image in Frame.
import java.io.File;
import java.io.IOException;
import java.awt.Frame;
import java.awt.image.RenderedImage;
import javax.media.jai.widget.ScrollingImagePanel;
import javax.media.jai.ImageLayout;
import javax.media.jai.NullOpImage;
import javax.media.jai.OpImage;
import com.sun.media.jai.codec.SeekableStream;
import com.sun.media.jai.codec.FileSeekableStream;
import com.sun.media.jai.codec.TIFFDecodeParam;
import com.sun.media.jai.codec.ImageDecoder;
import com.sun.media.jai.codec.ImageCodec;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.imageio.ImageReadParam.*;
class MultiPageRead extends JFrame
ScrollingImagePanel panel;
// JFrame mainFrame = new JFrame();
Container c;
public MultiPageRead(String filename) throws IOException
getContentPane();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setTitle("Multi page TIFF Reader");
setSize(980,1200);
getContentPane();
File file = new File(filename);
SeekableStream s = new FileSeekableStream(file);
TIFFDecodeParam param = null;
ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param);
System.out.println("Number of images in this TIFF: " + dec.getNumPages());
ImageLayout size = new ImageLayout(,0,12,12);
// Which of the multiple images in the TIFF file do we want to load
// 0 refers to the first, 1 to the second and so on.
int imageToLoad = 0;
RenderedImage op = new NullOpImage(dec.decodeAsRenderedImage(imageToLoad), null,
OpImage.OP_IO_BOUND,
size);
// Display the original in a 800x800 scrolling window
panel = new ScrollingImagePanel(op, 100, 200);
getContentPane().add(panel);
public static void main(String [] args)
String filename = args[0];
try {System.out.println("jfdfldjfldfjldjfjldjfjdjdjdjjdjdj");
MultiPageRead window = new MultiPageRead(filename);
window.pack();
window.show();
catch (java.io.IOException ioe)
System.out.println(ioe);
regards
jaggayyaChanging the fonts in Print using ABAP is not possible. as basic report output is a text editor.
By changing "Customizing of Local Layout" will only change in display screen and not in print.
One possible way to create a new printer formatr thry SPAD and use that format in while printing.
to know more details about SPAD
Using SPAD - SAP Spool Administration to print different paper size
The SAP spool system manages its own output devices. This includes mostly printers, but also fax and archiving devices. In order for you to use output devices defined in your operating system from the SAP System, you must define these devices in the SAP spool system.
Print to a dot matrix printer using computer paper with 66 lines
Define paper types
Formatting process Z_60_135
Page format DINA4
Orientation tick both Portrait and Orientation
Type in the comment and click save
Device initialization
Device type - OKI341
Formatting process Z_60_135 then click Execute
Double click Printer initilization
You must key the 66 lines hexadecimals for your printer. ( line no 9)
1 # oki341 x_paper
2 # reset
3 # \e\0x40
4 # select codepage multilingual 850
5 \e\0x52\0x1a
6 # disable skip perforation mode
7 \e\0x4f
8 # select 6 lpi
9 \e\0x32
10 # select page length 66 lines (66=hex $42)
11 \e\0x43\0x42
12 # select 10 cpi font
13 \e\0x60
CHECK THIS LINKS
http://help.sap.com/saphelp_nw04s/helpdata/en/df/abbb3f8e236d3fe10000000a114084/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/5a/4df93bad37f87ae10000000a114084/content.htm
http://www.geocities.com/SiliconValley/Grid/4858/sap/Basis/printprobs_solutions.htm
Hope this helps you
Regards
Pavan -
How to restrict the maximum size of a java.awt.ScrollPane
Dear all,
I would like to implement a scroll pane which is resizable, but not to a size exceeding the maximum size of the java.awt.Canvas that it contains.
I've sort of managed to do this by writing a subclass of java.awt.ScrollPane which implements java.awt.event.ComponentListener and has a componentResized method that checks whether the ScrollPane's viewport width (height) exceeds the content's preferred size, and if so, resizes the pane appropriately (see code below).
It seems to me, however, that there ought to be a simpler way to achieve this.
One slightly weird thing is that when the downsizing of the pane happens, the content can once be moved to the left by sliding the horizontal scrollbar, but not by clicking on the arrows. This causes one column of gray pixels to disappear and the rightmost column of the content to appear; subsequent actions on the scrollbar does not have any further effect. Likewise, the vertical scrollbar can also be moved up once.
Also, I would like a java.awt.Frame containing such a restrictedly resizable scrollpane, such that the Frame cannot be resized by the user such that its inside is larger than the maximum size of the scrollpane. The difficulty I encountered with that is that setSize on a Frame appears to set the size of the window including the decorations provided by the window manager (fvwm2, if that matters), and I haven't been able to find anything similar to getViewportSize, which would let me find out the size of the area inside the Frame which is available for the scrollpane which the frame contains.
Thanks in advance for hints and advice.
Here's the code of the componentResized method:
public void componentResized(java.awt.event.ComponentEvent e)
java.awt.Dimension contentSize = this.content.getPreferredSize();
this.content.setSize(contentSize);
java.awt.Dimension viewportSize = getViewportSize();
System.err.println("MaxSizeScrollPane: contentSize = " + contentSize);
System.err.println("MaxSizeScrollPane: viewportSize = " + viewportSize);
int dx = Math.max(0, (int) (viewportSize.getWidth() - contentSize.getWidth()));
int dy = Math.max(0, (int) (viewportSize.getHeight() - contentSize.getHeight()));
System.err.println("MaxSizeScrollPane: dx = " + dx + ", dy = " + dy);
if ((dx > 0) || (dy > 0))
java.awt.Dimension currentSize = getSize();
System.err.println("MaxSizeScrollPane: currentSize = " + currentSize);
setSize(new java.awt.Dimension(((int) currentSize.getWidth()) - dx, ((int) currentSize.getHeight()) - dy));
System.err.println();
}Best regards, Janimport java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
public class ScrollPaneTest
GraphicCanvas canvas;
CustomScrollPane scrollPane;
private Panel getScrollPanel()
canvas = new GraphicCanvas();
scrollPane = new CustomScrollPane();
scrollPane.add(canvas);
// GridBagLayout allows scrollPane to remain at
// its preferred size during resizing activity
Panel panel = new Panel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
panel.add(scrollPane, gbc);
return panel;
private WindowListener closer = new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
private Panel getUIPanel()
int w = canvas.width;
int h = canvas.height;
int visible = 100;
int minimum = 200;
int maximum = 500;
final Scrollbar
width = new Scrollbar(Scrollbar.HORIZONTAL, w,
visible, minimum, maximum),
height = new Scrollbar(Scrollbar.HORIZONTAL, h,
visible, minimum, maximum);
AdjustmentListener l = new AdjustmentListener()
public void adjustmentValueChanged(AdjustmentEvent e)
Scrollbar scrollbar = (Scrollbar)e.getSource();
int value = scrollbar.getValue();
if(scrollbar == width)
canvas.setWidth(value);
if(scrollbar == height)
canvas.setHeight(value);
canvas.invalidate();
scrollPane.validate();
width.addAdjustmentListener(l);
height.addAdjustmentListener(l);
Panel panel = new Panel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(2,2,2,2);
gbc.weightx = 1.0;
addComponents(new Label("width"), width, panel, gbc);
addComponents(new Label("height"), height, panel, gbc);
gbc.anchor = GridBagConstraints.CENTER;
return panel;
private void addComponents(Component c1, Component c2, Container c,
GridBagConstraints gbc)
gbc.anchor = GridBagConstraints.EAST;
c.add(c1, gbc);
gbc.anchor = GridBagConstraints.WEST;
c.add(c2, gbc);
public static void main(String[] args)
ScrollPaneTest test = new ScrollPaneTest();
Frame f = new Frame();
f.addWindowListener(test.closer);
f.add(test.getScrollPanel());
f.add(test.getUIPanel(), "South");
f.pack();
f.setLocation(200,200);
f.setVisible(true);
f.addComponentListener(new FrameSizer(f));
class GraphicCanvas extends Canvas
int width, height;
public GraphicCanvas()
width = 300;
height = 300;
public void paint(Graphics g)
super.paint(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int dia = Math.min(width, height)*7/8;
g2.setPaint(Color.blue);
g2.draw(new Rectangle2D.Double(width/16, height/16, width*7/8, height*7/8));
g2.setPaint(Color.green.darker());
g2.draw(new Ellipse2D.Double(width/2 - dia/2, height/2 - dia/2, dia-1, dia-1));
g2.setPaint(Color.red);
g2.draw(new Line2D.Double(width/16, height*15/16-1, width*15/16-1, height/16));
public Dimension getPreferredSize()
return new Dimension(width, height);
public Dimension getMaximumSize()
return getPreferredSize();
public void setWidth(int w)
width = w;
repaint();
public void setHeight(int h)
height = h;
repaint();
class CustomScrollPane extends ScrollPane
Dimension minimumSize;
public Dimension getPreferredSize()
Component child = getComponent(0);
if(child != null)
Dimension d = child.getPreferredSize();
if(minimumSize == null)
minimumSize = (Dimension)d.clone();
Insets insets = getInsets();
d.width += insets.left + insets.right;
d.height += insets.top + insets.bottom;
return d;
return null;
public Dimension getMinimumSize()
return minimumSize;
public Dimension getMaximumSize()
Component child = getComponent(0);
if(child != null)
return child.getMaximumSize();
return null;
class FrameSizer extends ComponentAdapter
Frame f;
public FrameSizer(Frame f)
this.f = f;
public void componentResized(ComponentEvent e)
Dimension needed = getSizeForViewport();
Dimension size = f.getSize();
if(size.width > needed.width || size.height > needed.height)
f.setSize(needed);
f.pack();
* returns the minimum required frame size that will allow
* the scrollPane to be displayed at its preferred size
private Dimension getSizeForViewport()
ScrollPane scrollPane = getScrollPane(f);
Insets insets = f.getInsets();
int w = scrollPane.getWidth() + insets.left + insets.right;
int h = getHeightOfChildren() + insets.top + insets.bottom;
return new Dimension(w, h);
private ScrollPane getScrollPane(Container cont)
Component[] c = cont.getComponents();
for(int j = 0; j < c.length; j++)
if(c[j] instanceof ScrollPane)
return (ScrollPane)c[j];
if(((Container)c[j]).getComponentCount() > 0)
return getScrollPane((Container)c[j]);
return null;
private int getHeightOfChildren()
Component[] c = f.getComponents();
int extraHeight = 0;
for(int j = 0; j < c.length; j++)
int height;
if(((Container)c[j]).getComponent(0) instanceof ScrollPane)
height = ((Container)c[j]).getComponent(0).getHeight();
else
height = c[j].getHeight();
extraHeight += height;
return extraHeight;
} -
How to calcalate the maximum size occupied by a table/row
Hi,
I am using the below query to find the maximum size occupied by a table per a row of data.
SQL> desc t2
Name Null? Type
NO NUMBER(1)
CH VARCHAR2(10)
SQL> select sum(data_length) from user_tab_columns where table_name='T2';
SUM(DATA_LENGTH)
32
Is this correct? Does oracle takes 22 bytes of space to store a column of Number(1) per a row as it shows below !?
1* select data_length from user_tab_columns where table_name='T2'
SQL> /
DATA_LENGTH
22
10
Please give your comments/suggestions
Thanks and Regards
SrikanthIf you are trying to do this for an existing table, you can get the actual number of bytes stored per column by:
SELECT VSIZE(column_name)
FROM tableSo, to get the largest row you could:
SELECT MAX(VSIZE(col1) + VSIZE(col2) ... + VSIZE(coln))
FROM tableIf you want to get the theoretical largest possible row size, then you can use something like:
SELECT SUM(DECODE(data_type,'NUMBER', ROUND((data_precision/2)+.1,0) +1,
'DATE', 7,
'LONG', 2147483648,
'BLOB', 4000,
'CLOB', 4000,
data_length)) max_length
FROM user_tab_columns
WHERE table_name = 'MY_TABLE'This works because:
For a number, Oracle stores two digits in each byte, and uses one byte for the mantissa. Note, if you are expecting negative numbers in your numeric columns then add one additional byte).
For a date, Oracle always requires 7 bytes.
A long is at most 2 GB in size.
Both Blobs and Clobs will be stored out-of-line when they are larger than about 4,000 bytes.
For other data types you specify bytes of storage when you define the column, and that is stored in data_length.
I'm not sure at this point what sort of sizes you would get for object type columns or nested tables.
HTH
John -
How to control the maximum time that a dynamic sql can execute
Hi,
I want to restrict the maximum time that a dynamic sql can execute in a plsql block.
If the execution is not completed, the execution should be terminated and a exception should be raised.
Please let me know, if there is any provision for the same in Oracle 10g.
I was reading about Oracle Resource Database Resource Manager, which talks about restricting the maximum time of execution for Oracle session for a user.
However I am not sure, if this can be used to control the execution of dynamic sql in a plsql block.
Please provide some pointers.
Thank you,
Warm Regards,
Navin Srivastavanavsriva wrote:
We are building a messaging framework, which is used to send time sensitive messages to boundary system.I assume this means across application/database/server boundaries? Or is the message processing fully localised in the Oracle database instance?
Every message has a time to live. if the processing of message does not occurs within the specified time, we have to rollback this processing and mark the message in error state.This is a problematic requirement.. Time is not consistent ito data processing on any platform (except real-time ones). For example, messageFoo1 has a TTL (time to live) of 1 sec. It needs to read a number of rows from a table. The mere factor of whether those rows are cached in the database buffer cache, or still residing on disk, will play a major role in execution time. Physical I/O is significantly slower that logical I/O.
As a result, with the rows on disk, messageFoo1 exceeds the 1s TTL and fails. messageFoo2 is an identical message. It now finds most of the rows that were read by messageFoo1 in the buffer cache, enabling it to complete its processing under 1s.
What is the business logic behind the fact that given this approach, messageFoo1 failed, and the identical messageFoo2 succeeded? The only difference was physical versus logical I/O. How can that influence the business validation/requirement model?
If it does, then you need to look instead at a real-time operating system and server platform. Not Windows/Linux/Unix/etc. Not Oracle/SQL-Server/DB2/etc.
TTL is also not time based in other s/w layers and processing. Take for example the traceroute and ping commands for the Internet Protocol (IP) stack. These commands send an ICMP (Internet Control Message Protocol) packet.
This packet is constructed with a TTL value too. When TTL is exceeded, the packet expires and the sender receives a notification packet to that regard.
However, this TTL is not time based, but "+hop+" based. Each server's IP stack that receives an ICMP packet as it is routed through the network, subtracts 1 from the TTL and the forwards the packet (with the new TTL value). When a server's IP stack sees that TTL is zero, it does not forward the packet (with a -1 TTL), but instead responds back to the sender with an ICMP packet informing the sender that the packet's TTL has expired.
As you can see, this is a very sensible and practical implementation of TTL. Imagine now that this is time based.. and the complexities that will be involved for the IP stack s/w to deal with it in that format.
Making exact response/execution times part of the actual functional business requirements need to be carefully considered.. as this is very unusual and typically only found in solutions implemented in real-time systems. -
How to control the window size of default message error
I have a form with many fields. (inputText)
These fields are marked with tag required="true"
When the user try to submit the form, the adf faces show a validation window displaying the label of the inputTexts and one message like this "This field are required".
The problem is that i have an inputText that have a large label and the window is showing with scrollbars and the layout is not good.
How can i control the layout of this default window ?
ThanksAt the moment I don't believe this to be fixable. From (maybe limited) investigation, we've been unable to discover a skin class to fix this.
CM. -
Popup image works fine but how to control the window size
Hello folks,
I use
<img title="Click to pop up large image" src="#OWNER#.view_my_file_form?p_file=#IMGID#" width="40" height="30" />
to popup a image window. It works just fine. How can I set the popup image window size? The window is too big but the image is too samll.
Many thanks.
MickeyThe popupURL function is defined as
function popupURL(url)
w = open(url,"winLov","Scrollbars=1,resizable=1,width=800,height=600");
if (w.opener == null) w.opener = self;
w.focus();
If 800x600 is too big for you, write your own mypopupURL function with whatever size you want -
How to control the size of live data in Coherence?
How to control the size of live data in Coherence?
See the following statement:
Pause times increase as the amount of live data in the heap increases. We recommend not exceeding 70% live data in your heap. This includes primary data, backup data, indexes, and application data.
--Excerpted from http://coherence.oracle.com/display/COH35UG/Best+PracticesIn any Java program, it is good practice to make sure your live objects leave some room in the heap for "scratch space." Without this, you will spend too much time in GC, and, in the worst cases, run out of memory. In the general case, you can see how much live data your application requires by looking at the heap used after a full GC's. For Coherence, you should ensure that live data, as you say, is under 70% of the maximum heap size.
Coherence provides you tools to help enforce this policy. [http://coherence.oracle.com/display/COH35UG/local-scheme] describes how to size limit your cache. By implementing an eviction policy, you can control what happens when a size limit is exceeded. -
How Do You Set the Maximum Size of a JFrame?
Can someone show me a quick example? The JFrame can be empty, I just want to know how to set it's maximum size. I tried using setMaximumSize() and it doesn't work for some reason but setMinimumSize() works fine.
I tried it using a BoxLayout and even using null as a layout manager and can't get it to work. I heard that the other layout managers don't allow you to set the maximum size of a JFrame so that is why I tried it with the layouts that I did.
I tried the following code (imported the necessary classes), but it does not work...
public class MyFrame extends JFrame
public MyFrame()
super("TestFrame");
setLayout( new BoxLayout(getContentPane(), BoxLayout.X_AXIS) );
setMaximumSize( new Dimension(400,200));
setSize(300,150);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible( true );
}// end classReposted from
{color:#0000ff}http://forum.java.sun.com/thread.jspa?threadID=5236259{color}
@OP:
When you repost a topic, please always provide a link to the previous post so people can check what suggestions were already offered (and didn't solve the problem).
Better still, give a short summary of the advice you have already tried.
I suggested setBackground(...) so you can see whether your MyFrame is actually occupying the entire real estate of the window. Looks as if trying it out (which I would have done for you if I'd been at home, where my JDK is) would have been too much effort for you.
I'm pretty much a novice in Swing, but I can tell you this: setLayout controls the layout of components added to the JFrame, not the layout of the frame with respect to its parent container.
Luck, Darryl -
How to control the size of SVG images in epub files?
There is unfortunately no support for SVG files in InDesign.
Most of my images in jpg convertes nicely, but the small ones do not.
Therefore I want to use SVG files which I have created in Illustrator.
But how do I set the size in the epub file? Right now, whatever I do, they come out too big and I don't know how to control the size.
Is there a program, like Sigil or other, that can place the image for me - I'm no html wizard you see....In any Java program, it is good practice to make sure your live objects leave some room in the heap for "scratch space." Without this, you will spend too much time in GC, and, in the worst cases, run out of memory. In the general case, you can see how much live data your application requires by looking at the heap used after a full GC's. For Coherence, you should ensure that live data, as you say, is under 70% of the maximum heap size.
Coherence provides you tools to help enforce this policy. [http://coherence.oracle.com/display/COH35UG/local-scheme] describes how to size limit your cache. By implementing an eviction policy, you can control what happens when a size limit is exceeded. -
How can i increase the maximum size of a text column in Access
hello,
i am inserting data in the MS-Access database through my servlet and am getting the exception whenever the length of the text data is more than 255 characters as in Access the maximum size for character data column is 255 can anyone tell me if there is any way by which i can increase the maximum limit of the column size in Access ,i.e. to make it more than 255.A text field in Access has a maximum size of 255 characters. If you want to store text information in Access larger than 255, you need to use the memo rather than text data type. There are special considerations for using an Access memo data type and accessing it through JDBC. Specifically, I believe it must be accessed as a binary object (BLOB), rather than text when using the JDBC-ODBC bridge. There are lots of discussions within these forums regarding how to manage, and the issues with using the Access memo data type.
Good luck! -
How to control the size of Database's image
hi,
I have already saved image in database, & i also can retrieve image from database. But My problem is that when i save big image then it shows with it's original size. But i want to see its size what i want? But how this possible?i want to see it's small size. i cannot do it. I know how to control the image with ImageIO . But i don'nt know how to control the size of an image from database. I cannot do it. Please Help me.
Thanks
binaHi,
You can control the database size at technical setting level based on ur requirement. Field name is Size category.
Thanks. -
How can I control the image size when I export form iphoto, the choice is too limited, I need to send a photo under 3 MB but if I choose high quaulity it is only 1.1 and i need to keep the best quaulity I can. Thanks for help.
Any image can only be as large as the Original. With a program like Photoshop you can UpRes an image and get it to a bigger size, larger files size as well, but the actual quality of the image will be degraded, depending on the UpRes system and the original quality of the image.
iPhoto is not the program to be doing that in and I don't think it even has that option.
So I suspect the image you are trying to send isn't much bigger than what you are getting. You can also try Exporting it from iPhoto to yopur desktop and see what size you end up with. If it is still that 209KB +/- file size then that is the size of the original image. -
How to control the size of the database
Hi all
Database size will gradually increase day by day is there any tool or possibility to control the size of the database.
Thanks in advance
Gowtham
Moderator message: not directly related to ABAP development, standard "basis" functionality, please have a look in the Netweaver forums.
Edited by: Thomas Zloch on May 23, 2011 9:16 AMHi,
You can control the database size at technical setting level based on ur requirement. Field name is Size category.
Thanks.
Maybe you are looking for
-
Back up I-Tunes files to a flash drive
I currently have my I-Tunes Library(3.67 GB)on an old Compac Presario and it will take 6 700mb discs to back it up, to be able to load it onto my new Acer laptop. How can I get I-Tunes to backup the Library to a 4 GB flash drive?
-
Why would iTunes (10.6.3) change my music files?
This isn't the first time I've had this problem. I have 79,042 songs in iTunes library. Every once in a while, I play a track that I've played many times before, only to discover that the music coming from the file is not longer what it was suppose
-
Creating a photo gallery / portfolio for a client to manage (CMS & Business Catalyst)
I have been asked to create a website for a client, the client is a photographer and wants a site to promote her nursery school photography business. She would like to be able to manage the site herself using the BC dashboard, uploading images as and
-
How can I transfer a diaporama from aperture to Quicktime ?
Hi, I did a diaporama and export it as a new library. Now i would like to transform it in a quicktime (.mov) product. I did already it but i don't remember how i did it. Have you an idea ?
-
I use a Mac so I am not sure to for about the Code for PC's. I use the following code on my webpage <EMBED SRC="HopeTownHV.mp4" style="position:absolute; left:288px; top:52px" WIDTH="399" HEIGHT="245" AUTOPLAY="true" CONTROLLER="false" </EMBED> Some,