How to resize a label automatically?
Hi;
I have a form and a label in it. That label should resize itself to fit the text in it. And after this resizing my code resize the form so that label fits in the form. The problem is, I dont know how to resize the label. (I dont mean label.setSize())
I can try it with taking length of the text inside and calculate the length. But some characters are bigger than others. (for example: I and M) So there can be mistakes. Is label supporting such a thing?
I don't know what you are talking about. As far as I can tell, the default behaviour for a JLabel is to resize itself to fit the text inside it. That's certainly how mine behave. So if yours don't do that then remove some code until they do.
The exception is if they don't have enough room to expand because they're taking up the whole width of the panel they are in. You asked how to resize the form so that there will be room? I don't think that's a good idea. Windows that change their size are an annoying UI feature, which is why you rarely see them. And what happens when your form resizes itself to be three times as wide as your screen?
However you might consider in future posting Swing questions in the Swing forum so you don't have to take advice from mediocre Swing programmers like me.
Similar Messages
-
How do I disable the automatic startup on HP Photosmart Premier when I turn my computer on?
Someone else posted ths question a month ago, but still no answers. Anyone?
How do I disable the automatic startup on HP Photosmart Premier when I turn my computer on?
Windows XP, SP3 operating system recently re-installed so I also reinstalled my printer software. Now, for some reason, each time I turn my computer on, my HP Photosmart C4100 all-in-one photosmart premier software opens. It is not in my startup. This slows down my computer terribly, which is why I never used the program before my re-install. How can I disable this feature? I only print, I don't use it for photos.
Any help here is appreciated.Run msconfig.exe from the start button (type in msconfig). When it comes up go to the Startup tab and find and deselect the HP product you do not want to start. Save and reboot computer. Now try.
Say thanks by clicking the Kudos Thumbs Up to the right in the post.
If my post resolved your problem, please mark it as an Accepted Solution ...
I worked for HP but now I'm retired! -
I can't figure out how to resize my picture for my home or lock screens.
I can't figure out how to resize my picture for my home or lock screens. It shouldn't be his difficult. Any suggestions? I'm running the latest software. Thanks.
whichever app store you are connecting to, hyou need a credit card with an address in that country. Also, itunes gift cards must be in local currency too.
If you are in japan, you need to use the japan app store -
How to install Oracle Label Security in Oracle Database 10g EE
Hello All
I just want to know how to install Oracle Label Security in Oracle 10g Database EE.
I read in Oracle Enterprise Manager Grid Control Installation and Basic Configuration that Label Security must be installed before installing Enterprise Manager Grid Control.
I have Oracle Database 10g Release 1 (10.1.0.1) on my Windows XP System, and I patch it to 10.1.0.3.
M.
Sorry about my English.Options is to connect to Oracle Policy Manager or use Oracle Internet Directory (OID)to administer Oracle Label Security.
Find more ways in the Documentation here:
http://download-uk.oracle.com/docs/cd/B19306_01/network.102/b14267/toc.htm -
How to resize a jpg/gif file to a fix size using jimi ?
I have search from the web and didn't find any example on doing this.
Can any one give example on how to resize a jpg image. let say 120x240
to a fixed size 40x40 ?
thank youHi.
When you got that image in form of a file, just load it and invoke the image's getScaledInstance(...)-method.
Here's how it could work:
import java.awt.*;
public class Test {
public static void main(String[] argv) {
// define where the image comes from:
URL toImage = new URL("file:/C:/test.jpg"); // or the like
// get the image:
Image image = Toolkit.getDefaultToolkit().createImage(toImage);
// scale the image to target size (40x40 here):
Image smallImage = image.getScaledInstance(40, 40, Image.SCALE_DEFAULT);
// you might want to do other things like displaying it afterwards
}HTH & cheers,
kelysar -
How to get Manager id automatically when Employee Id is given.
How to get Manager id automatically when Employee Id is given.
1) I created a simple BO with two elements namely
1.Employee Id
2.Manager id
How to get employee's first name and last name?
And how will i get manager id automatic when i click employee id in element field.
Anbu.Have you tried to use "APPS.FND_CONCURRENT" API?
http://etrm.oracle.com/pls/trm11510/etrm_pnav.show_object?c_name=FND_CONCURRENT&c_owner=APPS&c_type=PACKAGE
http://etrm.oracle.com/pls/trm11510/etrm_pnav.show_object?c_name=FND_CONCURRENT&c_owner=APPS&c_type=PACKAGE%20BODY
Thanks,
Hussein -
How to refersh a page automatically for every 10 mins
how to refersh a page automatically for every 10 mins
Hi,
Check this out. This may help you out -
http://stackoverflow.com/questions/552756/can-silverlight-initiate-page-refreshes
Thanks,
Pravin
"Please mark as answered, if this answers your question" -
How can I disable iPhoto automatic launch?
Hi,
I do not use iPhoto to import my digital images. How can I disable the automatic launch when I plug my camera or card reader?
Thanks!Hi Paul,
To do this just open Image Capture, open its preferences and then under the general tab you can select the option of "When a camera is connected, open:"
Just select no application and that should do it.
Sam -
How can I disable the automatic hiding of known file attachments, and why are always about 10 internet pages where I have to download something when I use mozila firefox?
Windows Computer1) If you are talking about the file names on the computer, there is a
setting to turn off known file types. Open your file browser. Then
just under the location bar, press '''Tools,''' then '''Folder Options.'''
A new window will open. Select '''View.''' Look for
'''Hide Extensions For Known File Types.'''
2) Never NEVER '''NEVER''' download anything unless you know what
it is. If a web site claims it needs to download something, what is it?
It could be something like the flash player, '''or a virus ! !'''
Ask questions, or go somewhere else. -
How to resize a table in Pages 5?
How to resize a table in Pages 5? It can be resized vertically but not horizontally.
stuart13 wrote:
How to resize a table in Pages 5? It can be resized vertically but not horizontally.
The controls are in the Format panel, Arrange Tab.
Jerry -
How to resize a photo from CameraUI?
Hi there,
i really need som help here. I cant seem understand how to resize an still image taken with the camera. Here are the code so far(also with the upload part). I just need a thumbnail to be uploaded to the server, not the HQ-image. Any ideas?
Simple AIR for iOS Package for selecting a cameraroll photo or taking a photo and processing it.
Copyright 2012 FIZIX Digital Agency
http://www.fizixstudios.com
For more information see the tutorial at:
http://www.fizixstudios.com/labs/do/view/id/air-ios-camera-and-uploading-photos
Notes:
This is a barebones script and is as generic as possible. The upload process is very basic,
the tutorial linked above gives information on how to post the image along with data to
your PHP script.
The PHP script will collect as $_FILES['Filedata'];
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.TouchEvent;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.media.Camera;
import flash.media.CameraUI;
import flash.media.CameraRoll;
import flash.media.MediaPromise;
import flash.media.MediaType;
import flash.events.MediaEvent;
import flash.events.Event;
import flash.events.ErrorEvent;
import flash.utils.IDataInput;
import flash.events.IEventDispatcher;
import flash.events.IOErrorEvent;
import flash.utils.ByteArray;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.errors.EOFError;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLRequestMethod;
// Define properties
var cameraRoll:CameraRoll = new CameraRoll(); // For Camera Roll
var cameraUI:CameraUI = new CameraUI(); // For Taking a Photo
var dataSource:IDataInput; // Data Source
var tempDir; // Our temporary directory
CameraTest() ;
function CameraTest()
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
// Start the home screen
startHomeScreen();
// =================================================================================
// startHomeScreen
// =================================================================================
function startHomeScreen()
trace("Main Screen Initialized");
// Add main screen event listeners
if(Multitouch.supportsGestureEvents)
mainScreen.startCamera.addEventListener(TouchEvent.TOUCH_TAP, initCamera);
mainScreen.startCameraRoll.addEventListener(TouchEvent.TOUCH_TAP, initCameraRoll);
else
mainScreen.startCamera.addEventListener(MouseEvent.CLICK, initCamera);
mainScreen.startCameraRoll.addEventListener(MouseEvent.CLICK, initCameraRoll);
// =================================================================================
// initCamera
// =================================================================================
function initCamera(evt:Event):void
trace("Starting Camera");
if( CameraUI.isSupported )
cameraUI.addEventListener(MediaEvent.COMPLETE, imageSelected);
cameraUI.addEventListener(Event.CANCEL, browseCancelled);
cameraUI.addEventListener(ErrorEvent.ERROR, mediaError);
cameraUI.launch(MediaType.IMAGE);
else
mainScreen.feedbackText.text = "This device does not support Camera functions.";
// =================================================================================
// initCameraRoll
// =================================================================================
function initCameraRoll(evt:Event):void
trace("Opening Camera Roll");
if(CameraRoll.supportsBrowseForImage)
mainScreen.feedbackText.text = "Opening Camera Roll.";
// Add event listeners for camera roll events
cameraRoll.addEventListener(MediaEvent.SELECT, imageSelected);
cameraRoll.addEventListener(Event.CANCEL, browseCancelled);
cameraRoll.addEventListener(ErrorEvent.ERROR, mediaError);
// Open up the camera roll
cameraRoll.browseForImage();
else
mainScreen.feedbackText.text = "This device does not support CameraRoll functions.";
// =================================================================================
// imageSelected
// =================================================================================
function imageSelected(evt:MediaEvent):void
mainScreen.feedbackText.text = "Image Selected";
// Create a new imagePromise
var imagePromise:MediaPromise = evt.data;
// Open our data source
dataSource = imagePromise.open();
if(imagePromise.isAsync )
mainScreen.feedbackText.text += "Asynchronous Mode Media Promise.";
var eventSource:IEventDispatcher = dataSource as IEventDispatcher;
eventSource.addEventListener( Event.COMPLETE, onMediaLoaded );
else
mainScreen.feedbackText.text += "Synchronous Mode Media Promise.";
readMediaData();
// =================================================================================
// browseCancelled
// =================================================================================
function browseCancelled(event:Event):void
mainScreen.feedbackText.text = "Browse CameraRoll Cancelled";
// =================================================================================
// mediaError
// =================================================================================
function mediaError(event:Event):void
mainScreen.feedbackText.text = "There was an error";
// =================================================================================
// onMediaLoaded
// =================================================================================
function onMediaLoaded( event:Event ):void
mainScreen.feedbackText.text += "Image Loaded.";
readMediaData();
// =================================================================================
// readMediaData
// =================================================================================
function readMediaData():void
mainScreen.feedbackText.text += "Reading Image Data.";
var imageBytes:ByteArray = new ByteArray();
dataSource.readBytes( imageBytes );
tempDir = File.createTempDirectory();
// Set the userURL
var serverURL:String = "http://www.hidden_in_this_example.com/upload.php";
// Get the date and create an image name
var now:Date = new Date();
var filename:String = "IMG" + now.fullYear + now.month + now.day + now.hours + now.minutes + now.seconds;
// Create the temp file
var temp:File = tempDir.resolvePath(filename);
// Create a new FileStream
var stream:FileStream = new FileStream();
stream.open(temp, FileMode.WRITE);
stream.writeBytes(imageBytes);
stream.close();
// Add event listeners for progress
temp.addEventListener(Event.COMPLETE, uploadComplete);
temp.addEventListener(IOErrorEvent.IO_ERROR, ioError);
// Try to upload the file
try
mainScreen.feedbackText.text += "Uploading File";
//temp.upload(new URLRequest(serverURL), "Filedata");
// We need to use URLVariables
var params:URLVariables = new URLVariables();
// Set the parameters that we will be posting alongside the image
params.userid = "1234567";
// Create a new URLRequest
var request:URLRequest = new URLRequest(serverURL);
// Set the request method to POST (as opposed to GET)
request.method = URLRequestMethod.POST;
// Put our parameters into request.data
request.data = params;
// Perform the upload
temp.upload(request, "Filedata");
catch( e:Error )
trace(e);
mainScreen.feedbackText.text += "Error Uploading File: " + e;
removeTempDir();
// =================================================================================
// removeTempDir
// =================================================================================
function removeTempDir():void
tempDir.deleteDirectory(true);
tempDir = null;
// ==================================================================================
// uploadComplete()
// ==================================================================================
function uploadComplete(event:Event):void
mainScreen.feedbackText.text += "Upload Complete";
// ==================================================================================
// ioError()
// ==================================================================================
function ioError(event:Event):void
mainScreen.feedbackText.text += "Unable to process photo";1. Create a BitmapData of the correct size of the full image
2. Use BitmapData.setPixels to create pixel data from your byteArray
3. Make a new Bitmap, Bitmap.bitmapData = BitmapData
4. Create a matrix with the correct scaling factors for your thumbnail
5. Create a new BitmapData the size of your thumb
6. Use BitmapData.draw to draw your image data from the Bitmap to the new BitmapData with the scaling matrix
7. Use BitmapData.getPixels to create a bytearray from your thumb BitmapData
8. save it
You'll have to look up the AS3 reference to see how all these methods work. -
I have MacAir with OS 10.8.4, how can I cancel the automatic link of my USB flashdisk to Mac instead of BootCamp, since I have one time press the ALT key before choosing "MAC" or "BOOTCAMP". Thanks
That only happens when you are running Windows in a Virtual Machine with OS X as the host. Shut down the VM and restart your Mac. Once the VM is running again and you insert a USB flash drive you should get that prompt again.
-
How do I turn off automatic sing in Skype?
How do I turn off automatic sing in Skype?
i work with Windows,Mac& ipad..Hi and welcome to the Skype Community,
On Skype for desktop (Windows, Mac) just use "Sign out" from the "Skype" menu once. This will take you back to the Skype sign in screen. Next time you sign in from there just make sure you have the "Sign me in when Skype starts" checkbox not checked.
On Skype for iPad:
Open the Skype app settings from the iOS settings menu. I think there should be an option to disable automatic sign in.
Follow the latest Skype Community News
↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓ -
How to change a label of User Type in OIM 11g
How to change a label of User Type in OIM 11g. If we have to change label of First Name or Last name then we can change in User.xml and some in resource properties file but what is the procedure to change for User Type.
Follow this: http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14309/uicust.htm#BABDEGFE
i .Copy the $OIM_ORACLE_HOME/server/apps/oim.ear/admin.war/WEB-INF/lib/IdentityTaskFlow.jar to a local work directory, unzip it and locate UserAttributes.properties at /oracle/iam/resources/IdentityTaskFlow.
ii. Update the userAttributes.properties file in the IdentityTaskFlow.jar/oracle/iam/resources/IdentityTaskFlow and create a new IdentityTaskFlow.jar
iii. Copy the updated IdentityTaskFlow.jar to $OIM_ORACLE_HOME/ server/apps/oim.ear/admin.war/WEB-INF/lib/
For "User Type", try putting the property name as "user_type" or try "role". One should work.
HTH,
BB -
In windows 7, how to make firefox start automatically when I turn on the computer
In Windows 7, how to make Firefox start automatically when I turn on the computer. Note, I am asking how to do this with Windows 7, not xp, not vista.
You need to place a shortcut to open Firefox in the Start > Programs > Startup folder.<br />
That is basically the same in all Windows versions.
Maybe you are looking for
-
How can I manage playlists on my iPhone 6?
I just got my iPhone 6 and can't figure out how to create and manage music playlists!! First I created one, added some tunes. but then I wasn't able to add more (the only editing options were to delete songs on the playlist or delete the list altoget
-
In my Ical i have multiple google calendars, from multiple accounts. I've got one calendar for my girlfriend (a Home account), so she can see my schedule and where i am. That brings a minor problem. In my Ical i have the same event now multiple times
-
Help to eject or unmount disk upon shutdown
Hello all, Please take pity on a newbie and answer what I hope is a really simple script question. This is my first attempt at Apple Script. I have searched for a script that will eject (unmount) a disk upon shutdown, but haven't found anything on th
-
I am two steps away from buying a new iphone and I love apple products!! But, I have been reading this forum for two weeks now and only seem to see people having problems with their iphones. I really need to know that having an iphone isn't as much t
-
Porque se calienta tanto mi macbook ?
tengo una macbook os xlion que compre desde el 2006 mas o menos quiero saber si tengo que comprar otro cargador nuevo o la pila de mi mac ya cumplio los ciclos que debe de llebar y tengo que reemplasarlo por otro nuevo.