Help: JPanel/JFrame display complexities, wrong size
I am trying to make a simple game of worms.I wan't to draw a rectangle in the center of the window where in the middle the game is played and on the outside score, lives and other such things are displayed. The problem is the rectangle won't draw properly because the window is the wrong size and I don't know if it is something I am doing wrong with the panel or frame.
import javax.swing.*;
import java.awt.*;
public class DemoWormPanel extends JPanel implements Runnable{
private static final int WIDTH = 600, HEIGHT = 400;
private Graphics dbG;
private Image dbImage;
private Thread animator;
private boolean running = false;
private Rectangle walls;
public DemoWormPanel() {
super();
setSize(WIDTH,HEIGHT);
public void startGame() {
if (animator == null) {
animator = new Thread(this);
animator.start();
running = true;
//defining game walls at 50 pixels within panel border
walls = new Rectangle(50, 50, WIDTH - 50, HEIGHT - 50);
public void gameRender() {
if (dbImage == null) {
dbImage = createImage(WIDTH, HEIGHT);
if (dbImage == null) {
System.out.println("Error creating double buffer");
System.exit(0);
dbG = dbImage.getGraphics();
dbG.setColor(Color.black);
dbG.fillRect(0,0,WIDTH,HEIGHT);
dbG.setColor(Color.white);
dbG.drawRect(walls.x, walls.y, walls.width, walls.height);
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(dbImage, 0, 0, this);
g.dispose();
public void update(Graphics g){
paint(g);
public void run() {
while (running) {
gameRender();
repaint();
try {
Thread.sleep(1000/50);
} catch (InterruptedException e) {}
System.exit(0);
public static void main(String[] args) {
DemoWormPanel wp = new DemoWormPanel();
JFrame f = new JFrame();
f.setTitle("Worms");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(wp);
f.setSize(WIDTH, HEIGHT);
f.setVisible(true);
wp.startGame();
}Somewhere in there is my problem.
What happens is that the right and bottom walls of the Rectangle are cut off of the screen because the window is not the right size. I changed the code to determine if the coordinates of the walls were accurate every iteration and they were. I also made it check the width and height every iteration by printing out this.getWidth() and this.getHeight() and found that instead of a 600 x 400 window, I have a 584 x 364. I also tried changing the panel and frame's size methods to make a new dimension instead of setting it directly from my constants and it had no effect. I also added directly to those constants to make it precisely 600 x 400 but the rectangle is still cut off, so maybe I also have a graphics issue. The only other potential issue I can think of is that I have Vista but I looked around here and searched google and found no similar issues to this.
I am not new to java but I am also not advanced. I just started using java again after about 6 months and I have made a pong game before without this problem, on another computer though.I am at my wits end. I'll check for responses tomorrow and thank you for any help or insight you can offer.
the problem is here
walls = new Rectangle(50, 50, WIDTH - 50, HEIGHT - 50);
at best the right/bottom walls will equal the frame's dimensions. try it as
walls = new Rectangle(50, 50, WIDTH - 100, HEIGHT - 100);
but this won't get you exactly what you want, due to the titlebar height (30?)
slightly different version
import javax.swing.*;
import java.awt.*;
class DemoWormPanel extends JPanel {
private static final int WIDTH = 600, HEIGHT = 400;
public DemoWormPanel() {
setBackground(Color.BLACK);
setPreferredSize(new Dimension(WIDTH-100,HEIGHT-100));
public static void main(String[] args) {
DemoWormPanel wp = new DemoWormPanel();
JFrame f = new JFrame();
f.setLayout(new GridBagLayout());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(wp,new GridBagConstraints());
f.setSize(WIDTH, HEIGHT);
f.setVisible(true);
}
Similar Messages
-
Hi,
I'm working on a Flash presentation, and I have a lot of text pages with buttons and movie clips on. The problem I have is that all subheads are set to size 35pt using Helvetica Neue Heavy, but on a couple of the pages a random subhead is displaying a lot larger than 35pt (I'd say 50pt) but it is definitely set to size 35pt in the Character palette. I have no idea why this is happening and it's driving me mad. Please can someone help me, I need to get this problem solved by Monday?
Kind regardsIf the text is assigned as the correct size, then it might be a case where you have something that contains the text scaled larger. You could try selecting the text or whatever contains it and then in the top menu choose Modify -> Reome Transform and see if that helps (might need to do it a couple times)
-
Button displayed with wrong size in gridbag layout
I am having a slight problem with gridbiglayout as it is not diplsying one of my buttons properly.
The code for my panel is given below. A screenshot of the ouput from my program can be seen at
http://i54.photobucket.com/albums/g117/vamega/Program%20Screenshots/programscreenshot.jpg
U can probably see that the button on the top right is not being displayed correctly.
It is supposed to be show donate and is the donateBookButton in the code below.
Any ideas on how to fix this would be really appreciates
package madiath.varun.vlibrary;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
* @author varunm
public class MainPanel extends JPanel
private GridBagLayout gb = new GridBagLayout();
private GridBagConstraints gc = new GridBagConstraints();
private GridLayout gridL = new GridLayout(1,3,10,10);
private Insets thisPanelsInsets = new Insets(10,10,10,10);
protected JButton returnBookButton;
protected JButton borrowBookButton;
protected JButton donateBookButton;
protected JPanel searchPanel;
protected JComboBox searchMenu;
protected JTextField searchText;
protected JButton searchButton;
protected JTable booksTable;
protected LibraryTableModel libTableModel;
protected ResultSetTableModel resTableModel;
protected JScrollPane tableScrollPane;
protected TableSorter sorter;
private String[] searchOptions = {"By Title", "By Author", "By Subject", "By ISBN", "Web Reviews"};
* Creates a new instance of MainPanel
public MainPanel(Librarian librarian, ResultSet InitialData) throws SQLException
initComponents(librarian, InitialData);
private void initComponents(Librarian librarian, ResultSet InitialData) throws SQLException
borrowBookButton = new JButton();
returnBookButton = new JButton();
donateBookButton = new JButton();
searchPanel = new JPanel();
searchMenu = new JComboBox();
searchText = new JTextField();
searchButton = new JButton();
booksTable = new JTable();
tableScrollPane = new JScrollPane();
resTableModel = new ResultSetTableModel(InitialData);
sorter = new TableSorter(resTableModel);
sorter.setTableHeader(booksTable.getTableHeader());
booksTable.setModel(sorter);
tableScrollPane.setViewportView(booksTable);
setLayout(gb);
borrowBookButton.setText("Borrow");
returnBookButton.setText("Return");
donateBookButton.setText("Donate");
searchButton.setText("GO");
searchText.setColumns(10);
searchPanel.setLayout(gridL);
searchPanel.add(searchText);
searchPanel.add(searchMenu);
searchPanel.add(searchButton);
Border searchBorder = BorderFactory.createMatteBorder(2,2,2,2,new Color(61,137,212));
searchBorder = BorderFactory.createTitledBorder(searchBorder,
"Search",
TitledBorder.LEFT,
TitledBorder.ABOVE_TOP);
searchPanel.setBorder(searchBorder);
searchMenu.setModel(new DefaultComboBoxModel(searchOptions));
gc.gridx = 1;
gc.gridy = 1;
gc.gridheight = 1;
gc.gridwidth = 1;
gc.insets.set(5,0,5,0);
gb.setConstraints(borrowBookButton, gc);
gc.gridx = 2;
gb.setConstraints(returnBookButton, gc);
gc.gridx = 3;
gb.setConstraints(donateBookButton, gc);
gc.gridy = 2;
gc.gridx = 2;
gc.gridwidth = 1;
gb.setConstraints(searchPanel, gc);
gc.gridx = 1;
gc.gridy = 3;
gc.gridwidth = gc.REMAINDER;
gc.weightx = 10;
gc.weighty = 5;
gc.insets.set(0,0,0,0);
gc.fill = gc.BOTH;
gb.setConstraints(tableScrollPane, gc);
add(borrowBookButton);
add(returnBookButton);
add(donateBookButton);
add(searchPanel);
add(tableScrollPane);
public Insets getInsets()
return thisPanelsInsets;
}I had done it using a workaroud of adding an ipadx value of 10 to the button.
If anyone can find a better solution please i would be very grateful. Executable code can be found below. This time i have added a main method. sorry about forgetting to do so last time :-()
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.JFrame;
public class MainPanel extends JPanel
private GridBagLayout gb = new GridBagLayout();
private GridBagConstraints gc = new GridBagConstraints();
private GridLayout gridL = new GridLayout(1,3,10,10);
private Insets thisPanelsInsets = new Insets(10,10,10,10);
protected JButton returnBookButton;
protected JButton borrowBookButton;
protected JButton donateBookButton;
protected JPanel searchPanel;
protected JComboBox searchMenu;
protected JTextField searchText;
protected JButton searchButton;
protected JTable booksTable;
protected DefaultTableModel model;
protected JScrollPane tableScrollPane;
private String[] searchOptions = {"By Title", "By Author", "By Subject", "By ISBN", "Web Reviews"};
* Creates a new instance of MainPanel
public MainPanel()
initComponents();
private void initComponents()
borrowBookButton = new JButton();
returnBookButton = new JButton();
donateBookButton = new JButton();
searchPanel = new JPanel();
searchMenu = new JComboBox();
searchText = new JTextField();
searchButton = new JButton();
booksTable = new JTable();
tableScrollPane = new JScrollPane();
model = new DefaultTableModel(
new Object[][]
{"something","something","something","something"},
{"something","something","something","something"},
{"something","something","something","something"},
{"something","something","something","something"}
new String[]{"Coloum 1","Coloum 2","Coloum 3","Coloum 4",}
booksTable.setModel(model);
tableScrollPane.setViewportView(booksTable);
setLayout(gb);
borrowBookButton.setText("Borrow");
returnBookButton.setText("Return");
donateBookButton.setText("Donate");
searchButton.setText("GO");
searchText.setColumns(10);
searchPanel.setLayout(gridL);
searchPanel.add(searchText);
searchPanel.add(searchMenu);
searchPanel.add(searchButton);
Border searchBorder = BorderFactory.createMatteBorder(2,2,2,2,new Color(61,137,212));
searchBorder = BorderFactory.createTitledBorder(searchBorder,
"Search",
TitledBorder.LEFT,
TitledBorder.ABOVE_TOP);
searchPanel.setBorder(searchBorder);
searchMenu.setModel(new DefaultComboBoxModel(searchOptions));
gc.gridx = 1;
gc.gridy = 1;
gc.gridheight = 1;
gc.gridwidth = 1;
gc.insets.set(5,0,5,0);
gb.setConstraints(borrowBookButton, gc);
gc.gridx = 2;
gb.setConstraints(returnBookButton, gc);
gc.gridx = 3;
gb.setConstraints(donateBookButton, gc);
gc.gridy = 2;
gc.gridx = 2;
gc.gridwidth = 1;
gb.setConstraints(searchPanel, gc);
gc.gridx = 1;
gc.gridy = 3;
gc.gridwidth = gc.REMAINDER;
gc.weightx = 10;
gc.weighty = 5;
gc.insets.set(0,0,0,0);
gc.fill = gc.BOTH;
gb.setConstraints(tableScrollPane, gc);
add(borrowBookButton);
add(returnBookButton);
add(donateBookButton);
add(searchPanel);
add(tableScrollPane);
public Insets getInsets()
return thisPanelsInsets;
public static void main(String[] args)
JFrame frame = new JFrame();
frame.add(new MainPanel());
frame.pack();
frame.setVisible(true);
} -
File displaying wrong size.
The file displaying the wrong size is Fallout New Vegas on a wineskin wrapper. The wrapper was 500 Megabytes. When I installed fallout New Vegas on the wrapper, it remained at 500 Megabytes. I had installed it on the Desktop and now my About my Mac is doing the same thing. It only displays the 500 megabytes the file shows. I clicked more info and it still said that. How do I fix this to display it?
BTW, when I copy it, it says 8.33 Gigabytes and that is it's correct size.The Mac is reporting file size in megabytes. Windows is reporting file size in mebibytes. The difference is that a megabyte is 1,000,000 bytes, while a mebibyte is 1,048,576 bytes. This change was made in Mac OS X so that reported disk sizes would agree with manufacturer's claimed sizes... most manufacturers claiming a size of 500 GB mean 500,000,000,000 bytes. Mac OS X will also call that number of bytes 500 GB, while Windows will call it 465.7 GB. That confused a lot of people.
For more information, see:
http://en.wikipedia.org/wiki/Gigabyte#Consumer_confusion -
Source monitor displays a different size to Program monitor in CC2014
I have imported a clip and the source monitor displays a different size in the program monitor?
Thanks ChrisIt looks like your sequence is set up for the wrong size. Select a video file and right click 'New Sequence from Clip' see if that helps. I see that your video material is HD did you set up the sequence to match the earlier stills? that might be bigger than HD? If that is the case make a sequence the size for the video and use 'scale to frame size' for the stills.
-
I'm having trouble getting a custom JPanel to display correctly...
HI, I'm having trouble getting a custom JPanel to display correctly. I'm using the JPanel inside a JFrame to display some really custom graphs. The graphing side of this whole thing works flawlessly. The problem I'm having is that when I close the JFrame by using setVisible(false); and then openning it again using setVisible(true); all the information on it is garbage. There are buttons from the JFrame which orgininally opened it and it has trouble openning a second graph if I choose too. I also have the same problem if i move the frame off the screen and move it back. I'd really appreciate any help.
Thanks!With option #1 -- I modified and rebuilt the 3rd-party JARs and referenced them in NetBeans. When I choose clean and build, the Ant processes results in an error: "jarsigner returns 1". So it doesn't seem to run at all.As long as you rebuilt the jars correctly without the original signature, I think it should work.
An example of unsigning a jar using ant is here:
http://frank.zinepal.com/unsign-a-jar-with-ant
Do you think the multiple-JNLP idea would work if NetBeans didn't apply "my" signature to the 3rd-party JARs? Aside from manually copying the original JARs into the \dist directory, is there a better way to tell NetBeans to leave the 3rd-party JAR alone (ie, don't sign it again)?I think it's supposed to work (it's the mixed code signing situation I referred to in my prior post).
For example, from your description it sounds like the default NetBeans build doesn't really support this style of deployment, so you would have to create a custom build which does what you need and is not triggered by NetBeans - which is doable, but annoying - it's sounds like you tried this, but were unable to get it to work as expected. For NetBeans specific help, you are better posting to a NetBeans forum (though you might be just the second person who has tried to do this with a JavaFX app).
Also need to check the end user experience is acceptable too, because I think the dialog and warning handling for the mixed code situation is different.
Look at the deployment guide section "Using <fx:resources> for Extension Descriptors" - I think it documents how to do what you want if you use a custom build file rather than letting NetBeans do the work:
http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference002.htm#CIABGCEE
Hmm, a lot of running around to deploy an app which can open a file . . . -
Mail app displays the wrong Inbox when you open it.
This problem can be easily reproduced if you have more than one email account configured in iOS 4.x
It should be extremely simple to fix with the next update. I see that this same problem has been mentioned before, but I couldn't update that thread because it's "archived." If you want Apple to fix this, please report the issue to Apple using one or more of the links below:
http://www.apple.com/feedback/ipodtouch.html
http://www.apple.com/feedback/iphone.html
http://www.apple.com/feedback/ipad.html (not sure if iPad Mail app is affected)
Here's what I submitted...
Subject:
Simple software design issue in Mail app.
Feedback Type:
Design/Ease of Use
Comments:
Thanks for your work on making iOS better and better with each update! There is no option to provide general iOS feedback, so I'll submit this under "iPhone" and "iPod." I'm currently using the latest iOS (4.3.1).
The native Mail app in iOS has had the Unified Inbox feature since iOS 4.0, which is very useful. However, there is a minor design flaw that could be easily resolved with a software update.
My setup:
I have 3 Exchange accounts on my device (Hotmail, Gmail[Default], Work). The Hotmail Inbox is empty at least 98% of the time because my Gmail account periodically downloads the messages. The only reason I have the Hotmail account entered on my device is to make sure I can see a message in "All Inboxes" even before my Google account retrieves it. On my device, the Gmail account is set as default for Mail and Contacts.
The problem:
I never intentionally select the Inbox for the Hotmail account because it should almost always be empty. I would simply view "All Inboxes." Still, half the time I open the Mail app, it shows the empty Hotmail Inbox. This is very annoying!
I finally figured out how to reproduce it consistently:
(must have more than one account configured)
1) Launch the Mail app and back-up to the screen that shows the list of accounts / Inboxes (I usually try to leave it here when I'm done, hoping to see that screen the next time I open Mail).
2) Without selecting a specific account or Inbox, push the Home button to exit the Mail app.
3) Kill the Mail process from the multi-tasking menu.
4) Open Mail again
Mail will show whichever Inbox comes immediately after "All Inboxes", even if it's not your default account. In my case, it starts in the empty Hotmail Inbox every time...a folder that I never intentionally select. Each time, I have to go back to the list and tap "All Inboxes."
So, if I leave Mail on the root screen before killing the process, it consistently displays the wrong Inbox the next time I open it. If I select an Inbox or "All Inboxes," it will remember that selection and show me that screen the next time I open Mail.
What it should do:
When Mail doesn't know which Inbox to display, it should...
A. Start on the root screen with the list of accounts and Inboxes (preferred option).
or B. Start in "All Inboxes" (secondary preference).
or C. Start in the Inbox of the default account (not preferred, but better than showing an empty/unused Inbox).
Thank you!
Message was edited by: Ichinisan
(not sure if iPad Mail app is affected)
Message was edited by: Ichinisan
Message was edited by: IchinisanTry this...
Launch the Mail app.
Navigate to the "Mailboxes" page (the page that lists all of your accounts).
Tap "Edit" in the top right corner.
Scroll down to the bottom section of the page, titled "ACCOUNTS".
Drag the triple-bars on the right to reorder the accounts listed. The first account listed will be the one that the app launches to.
Hope this helps, I went crazy trying to figure that out and it worked for me. -
How do I make a 20 X 30 print with layers of 16 X 20, 12 X 18, 11 X 14, 8 X 12, 8 X 10, 5 X 7 and 4 X 6 of the same image to display the different sizes available to someone? Using Elements 13 with Windows 8.1
A senior citizen needs some help.
ThanksSaving each image as different size - is it an option for you? I would save images with their name as: 20x30.png, 16x20.png etc etc.
Or explain whether you want these in a webpage in which case only one image is necessary and different sizes are displayed with good CSS code. this is question for Dreamweaver forum if this is what you want. -
Displaying trim box size with Acrobat Reader
I am looking for a way to have Acrobat Reader display Trim Box size. We have many Customer Service Reps and Sales people who receive PDFs from clients and cannot tell what the Trim Box size is except for asking me. I have Acrobat Pro and can easily find the information, but I am tired of being constantly asked. It does not make sense for all them to have Acrobat Pro. Any help is appreciated.
You need to Reader-enable the document, which allows Reader to do things it normally cannot. In Acrobat 9, you'd select: Advanced > Extend Features in Adobe Reader
In Acrobat 8 it's something different but very similar. Note that some people have reported problems when trying to use an enabled document in a different version of Reader than the version of Acrobat that was used to enable the document. -
Create custom document with wrong size
Hi,
I have a problem (on Sun Solaris 5.8) when I create custom document with more than 10MB size.
I've created an agent which detects the events on a custom data type
MYDOCUMENT (extension .mydoc).
When I put a new document test1.mydoc (size of 10MB for example), my agent detects the new document, creates a copy, sets the class object to
MYDOCUMENT , removes the original document and puts the copy into the same folder.
But sometimes, the copy created has a wrong size (less then 10MB).
How can I configure the nfs server to be sure that the agent waits for the complete size of the added document.
I need HELP !!!!
ThanksHi Pavithra,
yeah you can create your custom table by entering fields in Standard. for more details
refer below screen shots
Regards,
Thangam.P -
I am a rookie web designer. I recently created a site using CS6. http://www.joshuahetzler.com When I previewed the site in Dreamweaver it looked good in Firefox and IE. I published the site and now it is messed up in Firefox. All the text is the wrong size. Does anyone know how to fix this? Does it have something to do with my hosting provider? (I deleted a wordpress site from the directory an hourago and put this new site in its place) Why does IE display properly, but not Firefox...
Caused by a bad link to your site's CSS file. This is pointing to a file on your local hard drive which nobody but you can see.
<link href="file:///C|/hetzlerj/jhgc/menu.css" rel="stylesheet" type="text/css" />
Open your template and reconcile the path to your site folder. It should probably look like this:
<link href="../menu.css" rel="stylesheet" type="text/css" />
Save Template. Populate changes to Child pages. Upload Child pages.
Nancy O. -
How to make AI document display same physical size as mobile screen?
I know this seems like a bush-league sort of question, but I can't find the answer.
I'm designing some screens for an retina display iPad and I just want the illustrator document on my 27" thunderbold monitor (at 109 ppi) to have the same physical dimensions as the physical iPad screen (7.75" x 5.81"). Maybe its so obvious that no one talks about how to do it. I do feel a little embarassed that I haven't figured this out.
Regardless of whenther I enter the doucment dimensions in inches or in pixels the resulting document is never the same pysicial size as the iPad's screen. And since Illustrator deals in vectors it doesn't have any notion of PPI that I can use to bring inches and pixels into alignement so that what I see on my monitor is the same physical size as what's in the iPad.
All i want is the AI document displayed on my monitor to be the exact same size as my iPad's screen. Can anyone help?Photoshop has a "Screen Resolution" feature in its Settings which allows you to enter your screen resolution of 109 and this will display the physical size of images when you choose Print Size from the View menu. It simply will display the image at the appropriate zoom level for you. Unfortunately Illustrator doesn't have this, it always assumes that your monitor is 72ppi resolution. The problem with implementing custom monitor resolution in Illustrator is that it is a vector program and unlike Photoshop it doesn't have a ppi settings for its vector objects which are resolution independent. For the use of its rulers and numerical dimensions input when set to pixels, it has to assume an eventual ppi rasterization of the vector objects. If Illustrator uses the same feature like Photoshop then the same Illustrator file will show different pixel dimensions depending on which monitor it is displayed which may cause a much greater confusion than the problem you have now.
To find the physical size in Illustrator, right click on its ruler and set it to units that you have on a real life ruler. Then put the real life ruler on your screen and change the zoom level until the rulers in Illustrator are the same size as the real life ruler. Then write down the zoom level and use it again when you want to check the physical size of your work.
I think with your 109 ppi monitor, the zoom level should be about 152% -
How to set JFrame MEX and MIN size ?
Hello All,
i want to set my jframe meximum and minimum size but
i cant find any method please help me.
i m thanksfull.
Arif.In this case minimum size is 100 and max is 400!
I hope it helps
import java.awt.*;
import javax.swing.JFrame;
import java.awt.event.*;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
public class Frame1 extends JFrame {
final int minw=100;
final int maxw=400;
final int minh=100;
final int maxh=400;
public Frame1() {
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
public static void main(String[] args) {
Frame1 frame1 = new Frame1();
frame1.setBounds(0,0,100,100);
frame1.setVisible(true);
private void jbInit() throws Exception {
this.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(ComponentEvent e){
frame_resized();
public void frame_resized(){
int hh=this.getHeight();
int ww=this.getWidth();
if((!(minh<hh && hh<maxh))||( !(minw<ww && ww <maxw))){
if( hh<minh)
hh=minh;
if( hh>maxh)
hh=maxh;
if( ww<minw)
ww=minh;
if( ww>maxw)
ww=maxw;
this.setSize(ww,hh);
Bye Alessio -
Hi,
I stored a .jpg file in a BLOB using Oracle 9i.
When i try to read it, i get the wrong size for the Blob.length() ...
Please can someone help ...
File file = new File(fileLoc);
InputStream is = new FileInputStream(file);
long length = file.length();
OutputStream outstream = blob.setBinaryStream(length);
byte[] buffer = new byte[(int)length];
int readlength = -1;
while ((readlength = is.read(buffer)) != -1)
outstream.write(buffer, 0, readlength);
is.close();
outstream.flush();
outstream.close();
// TRY TO READ NOW
// Here comes some JDBC stuff ...
File newFile = new File("blob.jpg");
FileOutputStream fos = new FileOutputStream(newFile);
InputStream is2 = blob2.getBinaryStream();
byte[] bb = new byte[(int)blob2.length()];
int readlength2 = -1;
while ((readlength2 = is2.read(bb)) != -1)
fos.write(bb, 0, readlength2);
is2.close();
fos.flush();
fos.close();I don't see anything wrong with it myself... assuming that your changes are being committed somewhere...
Somewhere in the collection of examples at
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/index.html
is a good working example with a CLOB, which should be the just about the same. I think there was also a BLOB example, but I'm not sure... -
What am I doing wrong - size issue
Need some advice...as usual!
I designed a site on my 17" monitor and set the margins to 0
and table to 100%. However when I look at it on different screens
it looks rubbish...big gap at the bottom of the page with the
design cramp at the top. I wonder if someone would mind looking at
my code and see what's wrong with it. The site was designed using
various techniques including css for nav bars, tables, and
fireworks elements. the site can be viewed at:
www.shelleyhadler.co.uk/nerja.html
thanks for your help. Shell>Re: What ams I doing wrong - size issue.
Several things...
First, your 17" monitor has noting to do with web page
layout. What
resolution is your monitor set to? it could be 800 pixels
wide or 1280
pixels... wouldn't that make a difference? That aside, screen
resolution and
size are irrelevant anyway. What counts it eh size that your
viewers have
their web browser window set at.
I have a pretty large monitor, set to a very high resolution,
so I open
several windows at once and size them so I can see the
content in all.
Sometimes my browser is full screen and sometimes its shrunk
down to less
than 600 x 800. Your web site needs to accommodate that.
Every web viewer
out there is different and likes the way they have their
screens set up. So
you need to be flexible and your site needs to be flexible.
Next, Don't design in Fireworks and import to Dreamweaver.
Fireworks is a
superb web ready graphics and imaging processing program. The
authors
(mistakenly) threw in some web authoring stuff that works
very poorly.
Design your pages using Dreamweaver. Learn html markup and
css styling to
arrange it, then use Fireworks to create graphics to support
your content.
Along the way, be aware of the diffferant browsers in use.
Internet
Explorer is the most popular (or at least most in use) simply
by virtue of
the Microsoft market share, but it is also the least web
complient (by virue
of the Microsoft arrogance) so some things that work there,
(like your green
bands) won't on other browsers and vice versa.
That said... graphically, your site looks great. You have a
good eye for
composition and simple clean design. You just need to learn
to use html to
your best advantage to create some realy nice looking and
nicely working
sites.
"shelleyfish" <[email protected]> wrote in
message
news:[email protected]...
> Need some advice...as usual!
>
> I designed a site on my 17" monitor and set the margins
to 0 and table to
> 100%. However when I look at it on different screens it
looks
> rubbish...big
> gap at the bottom of the page with the design cramp at
the top. I wonder
> if
> someone would mind looking at my code and see what's
wrong with it. The
> site
> was designed using various techniques including css for
nav bars, tables,
> and
> fireworks elements. the site can be viewed at:
>
> www.shelleyhadler.co.uk/nerja.html
>
> thanks for your help. Shell
>
Maybe you are looking for
-
How to turn off voice control with iPhone 5s with iOS 8
I Dropped my phone in the tub, I have an otterbox on it but it didn't do the phone any good :/. I dried it off and the home button started acting up. And now it doesnt work when i hit it. But the Touch ID still works. However randomly voice control w
-
Sound through HDMI does not work on eeebox eb1501p
So, as the topic states I can't get sound to work through HDMI. aplay -l says: **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0:
-
"Object Picker cannot open because no locations from which to choose objects can be found"
Hi, When I try in AD management console in the domain controller to add a new group for a user I get the following error: "Object Picker cannot open because no locations from which to choose objects can be found" error message when you try to select
-
Runtime error when searching ituens store
How do I fix a runtime error when I serch in itunes?
-
Search has taken over my home page and search page. I understand that it is a malicious virus that is designed to send lots of adds and also invade the PC and find out personal details. I accidentally installed this while working on wordpress. I rece