SETTING THE FRAME STYLE
Do you know how you can change what buttons are available on the top right of the frame.
As a default there are the three buttons: minimise, restore up/down and then close. How do you create a frame without these buttons and how do you create a frame with just the close button.
I know that it can be done as you see frames like this everywhere.
Manny thanks.
a first guess:
use a JFrame superclass:
public class MyFrame extends JWindow
//... code
// you need to hand set all window appearence and
// functionality
}
Similar Messages
-
I am Making a program for purchasing games, with the basic layout alsot done, except on problem. When the purchase button is pressed, a dialog shows up but nothing is seen until i resize it. How would i set the frame size so that i do not need to resize it each time? below is the code for the files. Many thanks in advance.
CreditDialog
import java.awt.*;
import java.awt.event.*;
class CreditDialog extends Dialog implements ActionListener { // Begin Class
private Label creditLabel = new Label("Message space here",Label.RIGHT);
private String creditMessage;
private TextField remove = new TextField(20);
private Button okButton = new Button("OK");
public CreditDialog(Frame frameIn, String message) { // Begin Public
super(frameIn); // call the constructor of dialog
creditLabel.setText(message);
add("North",creditLabel);
add("Center",remove);
add("South",okButton);
okButton.addActionListener(this);
setLocation(150,150); // set the location of the dialog box
setVisible(true); // make the dialog box visible
} // End Public
public void actionPerformed(ActionEvent e) { // Begin actionPerformed
// dispose(); // close dialog box
} // End actionPerformed
} // End Class
MobileGame
import java.awt.*;
import java.awt.event.*;
class MobileGame extends Panel implements ActionListener { // Begin Class
The Buttons, Labels, TextFields, TextArea
and Panels will be created first.
private int noOfGames;
// private GameList list;
private Panel topPanel = new Panel();
private Panel middlePanel = new Panel();
private Panel bottomPanel = new Panel();
private Label saleLabel = new Label ("Java Games For Sale",Label.RIGHT);
private TextArea saleArea = new TextArea(7, 25);
private Button addButton = new Button("Add to Basket");
private TextField add = new TextField(3);
private Label currentLabel = new Label ("Java Games For Sale",Label.RIGHT);
private TextArea currentArea = new TextArea(3, 25);
private Button removeButton = new Button("Remove from Basket");
private TextField remove = new TextField(3);
private Button purchaseButton = new Button("Purchase");
private ObjectList gameList = new ObjectList(20);
Frame parentFrame; //needed to associate with dialog
All the above will be added to the interface
so that they are visible to the user.
public MobileGame (Frame frameIn) { // Begin Constructor
parentFrame = frameIn;
topPanel.add(saleLabel);
topPanel.add(saleArea);
topPanel.add(addButton);
topPanel.add(add);
middlePanel.add(currentLabel);
middlePanel.add(currentArea);
bottomPanel.add(removeButton);
bottomPanel.add(remove);
bottomPanel.add(purchaseButton);
this.add("North", topPanel);
this.add("Center", middlePanel);
this.add("South", bottomPanel);
addButton.addActionListener(this);
removeButton.addActionListener(this);
purchaseButton.addActionListener(this);
The following line of code below is
needed inorder for the games to be
loaded into the SaleArea
} // End Constructor
All the operations which will be performed are
going to be written below. This includes the
Add, Remove and Purchase.
public void actionPerformed (ActionEvent e) { // Begin actionPerformed
If the Add to Basket Button is pressed, a
suitable message will appear to say if the game
was successfully added or not. If not, an
ErrorDialog box will appear stateing the error.
if(e.getSource() == addButton) { // Begin Add to Basket
// GameFileHandler.readRecords(list);
try { // Begin Try
String gameEntered = add.getText();
if (gameEntered.length() == 0 ) {
new ErrorDialog (parentFrame,"Feild Blank");
} else if (Integer.parseInt(gameEntered)< 0
|| Integer.parseInt(gameEntered)>noOfGames) { // Begin Else If
new ErrorDialog (parentFrame,"Invalid Game Number");
} else { // Begin Else If
//ADD GAME
} // End Else
} catch (NumberFormatException num) { // Begin Catch
new ErrorDialog(parentFrame,"Please enter an Integer only");
} // End Catch
} // End Add to Basket
If the Remove From Basket Button is pressed, a
a suitable message will appear to say if the
removal was successful or not. If not, an
ErrorDialog box will appear stateing the error.
if(e.getSource() == removeButton) { // Begin Remove from Basket
try { // Begin Try
String gameEntered = remove.getText();
if (gameEntered.length() == 0 ) {
new ErrorDialog (parentFrame,"Feild Blank");
} else if (Integer.parseInt(gameEntered)< 1
|| Integer.parseInt(gameEntered)>noOfGames) { // Begin Else If
new ErrorDialog (parentFrame,"Invalid Game Number");
} else { // Begin Else If
//ADD GAME CODE
} // End Else
} catch (NumberFormatException num) { // Begin Catch
new ErrorDialog(parentFrame,"Please enter an Integer only");
} // End Catch
} // End Remove from Basket
If the purchase button is pressed, the
following is executed. NOTE: nothing is done
when the ok button is pressed, the window
just closes.
if(e.getSource() == purchaseButton) { // Begin Purchase
String gameEntered = currentArea.getText();
if (gameEntered.length() == 0 ) {
new ErrorDialog (parentFrame,"Nothing to Purchase");
} else { // Begin Else If
new CreditDialog(parentFrame,"Cost � 00.00. Please enter Credit Card Number");
} // End Else
} // End Purchase
} // End actionPerformed
} // End Class
RunMobileGame
import java.awt.*;
public class RunMobileGame { // Begin Class
public static void main (String[] args) { // Begin Main
EasyFrame frame = new EasyFrame();
frame.setTitle("Game Purchase for 3G Mobile Phone");
MobileGame purchase = new MobileGame(frame); //need frame for dialog
frame.setSize(500,300); // sets frame size
frame.setBackground(Color.lightGray); // sets frame colour
frame.add(purchase); // adds frame
frame.setVisible(true); // makes the frame visible
} // End Main
} // End Class
EasyFrame
import java.awt.*;
import java.awt.event.*;
public class EasyFrame extends Frame implements WindowListener {
public EasyFrame()
addWindowListener(this);
public EasyFrame(String msg)
super(msg);
addWindowListener(this);
public void windowClosing(WindowEvent e)
dispose();
public void windowDeactivated(WindowEvent e)
public void windowActivated(WindowEvent e)
public void windowDeiconified(WindowEvent e)
public void windowIconified(WindowEvent e)
public void windowClosed(WindowEvent e)
System.exit(0);
public void windowOpened(WindowEvent e)
} // end EasyFrame class
ObjectList
class ObjectList
private Object[] object ;
private int total ;
public ObjectList(int sizeIn)
object = new Object[sizeIn];
total = 0;
public boolean add(Object objectIn)
if(!isFull())
object[total] = objectIn;
total++;
return true;
else
return false;
public boolean isEmpty()
if(total==0)
return true;
else
return false;
public boolean isFull()
if(total==object.length)
return true;
else
return false;
public Object getObject(int i)
return object[i-1];
public int getTotal()
return total;
public boolean remove(int numberIn)
// check that a valid index has been supplied
if(numberIn >= 1 && numberIn <= total)
{ // overwrite object by shifting following objects along
for(int i = numberIn-1; i <= total-2; i++)
object[i] = object[i+1];
total--; // Decrement total number of objects
return true;
else // remove was unsuccessful
return false;
ErrorDialog
import java.awt.*;
import java.awt.event.*;
class ErrorDialog extends Dialog implements ActionListener {
private Label errorLabel = new Label("Message space here",Label.CENTER);
private String errorMessage;
private Button okButton = new Button("OK");
public ErrorDialog(Frame frameIn, String message) {
/* call the constructor of Dialog with the associated
frame as a parameter */
super(frameIn);
// add the components to the Dialog
errorLabel.setText(message);
add("North",errorLabel);
add("South",okButton);
// add the ActionListener
okButton.addActionListener(this);
/* set the location of the dialogue window, relative to the top
left-hand corner of the frame */
setLocation(100,100);
// use the pack method to automatically size the dialogue window
pack();
// make the dialogue visible
setVisible(true);
/* the actionPerformed method determines what happens
when the okButton is pressed */
public void actionPerformed(ActionEvent e) {
dispose(); // no other possible action!
} // end class
I Know there are alot of files. Any help will be much appreciated. Once again, Many thanks in advancesetSize (600, 200);orpack ();Kind regards,
Levi
PS:
int i;
parses to
int i;
, but
[code] int i;[code[i]]
parses to
int i; -
How to set the frame size?
Hi,
Can some one show me how to set the frame size in this program? History: I have created a window and added a button but its to small. So I want to increase the size of the frame to at least 600X400 pixel.
private static void showGUI() {
//Create and set up the window.
JFrame frame = new JFrame("ButtonDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
Main newContentPane = new Main();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
}It would be nice if you could show me how to do it.
Thank you very much for reading this.Challenger wrote:
Simply adding
frame.setSize(new Dimension(600,400));to the end of your code should work perfectly.Or, if you want to do it correctly, .setPreferredSize() on your frame before you .pack() it. The default layout manager for JFrame is BorderLayout, which uses the preferredSize of each component to calculate sizes during the .pack() call. -
Set the css style of text in a column according to the value of another col
I'd like to set the css style of text in a column according to the value of another column. Each field may end up with a different style of text as a result, for instance.
Any ideas? I looked thru the forums but couldn't find anything.
Thanks,
LindaDoes the class=t7Header make it into the rendered HTML?
---The text "class="tHeader" does not show but the other text is rendered using the style t7Header as defined in the stylesheet! Exactly what I wanted.
You might want to use a div or a span instead of a p.
---Yes -
What's very cool is we can create a display column that is dynamically filled with the html and style wrappers based on a lookup to see what style should be applied according to the actual data value. This is critical as our tables are all dynamic so I can't depend on using the additional APEX methods to control the display of a column (as the # of columns in the view vary from instance to instance) and I did not want the display specs to muddy up my SQL queries.
I wonder why this is not well documented. It is so easy!
Thanks again for your help.
Linda -
Setting the default style sheet
I am trying to set the default style sheet to my customized css - mainstyle19-en.css. I know that I have to run this command - ant make_main_css -DCOLOR=19 but I don't have ant in my path and it is not recognizing it as a command. How do you put that in the path? Also - where are you supposed to run this command? I know somewhere on the server where the image server is located, but where exactly?
Thanks for your help,
Karen.In addition, if you are using .net, Sarah Wheeler created a simple portlet that allows the user to create a header portlet with the ability to change the stylesheet. I have modified it a little and would be happy to share my version. Take a look at this thread - http://portal.plumtree.com/portal/server.pt/gateway/PTARGS_0_283309_4352_2758_4823_43/http;/PRODGADGET12.plumtree.com/collab/discussion/app/threadDetails.jsp?projID=39883&forumID=48674&threadID=80810&messageID=80894 (If the link doesn't work, it is located Discussions: Pluggable Nav, Style Sheet Mill, PEI, UI Cust: Changing colors/style sheets with custom header portlets?)
If you send me an email at [email protected] will send you the code.
Michael [email protected] -
Setting the font style of a TitleWindow or Panel w/o creating a skin?
N00b question - Is it possible to set the font style of a TitleWindow or Panel header/label with out creating a custom skin? Looking for a simple way and I can find one in the docs.
Thanks in advanceYes, using advanced css to style the specific title label in the skin:
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
s|Panel #titleDisplay
fontStyle: italic
</fx:Style>
<s:Panel title="hello" />
-Kevin -
How do I set the frame rate to 12fps on my video, and it not change randomly?
Hi, I imported a video layer from file then set the frame rate to 12fps, when I play the video it keeps changing the frame rate to random times. How do I keep it at 12fps
Click the windows start button, then right click on computer, this will bring up a window that will tell you how much ram your system has.
Also Start>Accessories>System Tools>System Information will give you all the details you need to know.
As for Codec, That is an abreviation for code/decode it tells windows how to code when saving a video and how to decode when playing a video. Most formats are wrappers (avi, wmv, mov, rt) Each of these have a codec that you can choose from when saving a video, that codec then must be installed on the users computer to see that same video. Most formats come with a basic number of codecs and the creator of the video can purchase other codecs that provide better feature set.
What the codec really does is takes the video and compresses it like a zip file then the user when playing require that codec to uncompress it.
So each codec has its own strength and weaknesses. Some can compress more making a smaller file and perhaps inturn removes more data to get that compression and therefore has a poorer quailty video (just an example)
I am sure you heard of a few codecs if you think about it. mpg, mp2, mp3, mp4, h.264 and so on. Mp3 is the only one I listed here that is for audio only. Yep thats right even audio uses codecs. -
Setting the frame of an object based on collisions
I'm almost done with a project I've been working on for a while and need help with the Actionscript. I first got help here: http://forums.adobe.com/message/4706107#4706107 ; basically what I set up was that an object would change its frame based on what other objects it was colliding with. I'm working with hundreds of objects that will change based on their position onscreen so it's necessary to set up a script to do this automatically. I don't know Actionscript at all, but I got a lot of help and we finally came up with this code:
stage.addEventListener(Event.ENTER_FRAME, checkForHit);
var objects:Array = new Array(obj, obj2);
function checkForHit():void {
for(var i=0; i<objects.length; i++){
for(var n=1; n<22; n++){
if(objects[i].hitTestObject(this["invisibleObj"+String(n)]){
objects[i].gotoAndStop(n);
break;
The problem I'm running into now is that if an object specified in "new Array" isn't onscreen, none of the rest of the objects respond to the code. Is there a way to make this code work regardless of whether all objects specified are onscreen or not? Also, would there be a way to set the new Array objects to something like "obj*" so I didn't have to actually type in every single one of the hundreds of objects I'll be placing onscreen?
Thanks so much for the help! I'm really stuck without it.If you place all the objects in a container they will still be able to be hitTested with objects outside of the container. If the objects are all passing by, then having them in the container might ease your burden since you could nove the container rather than each individual object.
To make the container just create an empty movieclip (or Sprite) symbol and place it on the stage at 0,0. Open it up for editing and plant your 'object's as needed inside of it - no names needed unless you have other need for them. Then when you want to do your hitTesting you loop thru the children of the container. Here's how the code changes if you do that and assign a name to that container of "objectContainer" (name it as you please)...
function checkForHit():void {
for(var i=0; i<objectContainer.numChildren; i++){
var obj:MovieClip = MovieClip(objectContainer.getChildAt(i));
for(var n=1; n<22; n++){
if(obj.hitTestObject(this["invisibleObj"+String(n)]){
obj.gotoAndStop(n);
break; -
How do you set the frame size?
Trying to set a frame size for 1920px X 1080px but can't see where to set this in a new project?
Frame dimensions are a property of the sequence, not the project. A project can contain multiple sequences with different properties.
File>New>Sequence opens a dialog where you can choose a preset or configure custom settings. Several of the preset groups have 1920x1080 options.
Asssuming you have footage of those dimensions that you'll be using in the sequence, then you can simply create a sequence from an asset. Either drag it to the New Item button in the Project panel's lower right corner, or right-click it and select New Sequence from Clip. -
Setting the font style and color for FileChooser labels
Hi Friends,
I have a certain standard Font style and color set for my application GUI. Now, I want to set the style and color for Swing components like FileChooser. Is it possible ?
Also is it possible to localize JOptionPane ?
Please advise.
Best regards,
Harilal.Does anybody knows how to do that?
-
Hi, I'm working with C# and COM automation to compile a tv guide. I need to apply for every textframe the right char style. Right now I parse each char and I set the style in this way:
ch.AppliedCharacterStyle = charStyle;
this tast is very slow process.
How can I work on a set of characters appplying the style in a single command? Is it possible?
Thanks a lot,
AndreaI don't think that GREP will be usefull ;)
Andrea need to find begin and end of interesting part of Paragraph content
time is easy - first 5 chars or to first space
but finding the rest ... or wait ;)
Andrea - do all your listings have structure:
(time)( )(type)( )(title)
where:
(time) is 4 or 5 characters
(type) is any text without spaces
(title) is title without any other parts like, description, rating, etc.
and all parts are separated by ( ) - space ?
if yes - you can use NestedStyles feature of ParagraphStyle - by setting " " (space) as first and second "up to" sperarator
and one more question - can you export or can you request TV listing in other format - with (tab) as "field" separator ?
below is link to example InDesign Tagged Text file with ParagraphStyles set to " " (space) as separator
http://www.adobescripts.com/TVGuide.zip
just place it to your InDesign document :)
robin
www.adobescripts.com -
In FF 3.5 through 4.0b11, the Tree-style Tabs extension kept tabs open when I exited so that when I re-opened the program, all tabs re-opened at the same time. Now, every time I return ot the program, I have to re-load all of the tabs I use on a daily basis.
Hi,
I'm using the Tree Style Tab and love it.
However, I was wondering if there's a way to collapse/expand the tab sidebar using a keyboard shortcut.
Ideas, anyone?
Iddo -
Is there a property to set the "Line Style" of the "X" & "Y" Grids of a Waveform Graph?
I found the properties to change the colors, but not the "Line Styles". (I want to change them from solid to dashed lines).
Sorry wd8ivl, I misread the query.
You cannot change the xy gridlines to dash, only change the colour.
Have a look at this post for some ideas.
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=50650000000800000097A90000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_TIER_0=0&USEARCHCONTEXT_TIER_S=0&USEARCHCONTEXT_QUESTION_0=grid+dashed&USEARCHCONTEXT_QUESTION_S=0 -
Every time I save a gif on photoshop it automatically sets the frames to "do not dispose"
Then I'll open it to change the set frame of the layers to "automatic" but it goes back to "do not dispose" How can I stop this from happening? I already reset my settings on photoshop.
You posted in the Photoshop.com sharing and storage migration to revel forum. Photoshop.com sharing and storage is being discontinued. You can use Revel (an alternative cloud storage and sharing choice) to store files in the cloud now if you like. Currently it supports jpg files only. Go to Adoberevel.com to check it out or download the app for mac or iOS.
It sounds like you want the elements/photoshop.com forum, so I will move this.
Pattie -
It's possible to set the number of frame?
It is recommand to set the number of channels as low as possible, and it is easy to do. But it is recommended to decrease the number of frames? If yes, how can i do it? It seems to me that the manuals do not mention this aspect.
Thanks.Yes but if it is so why it is recommended to set the numbers of channels as low as possible?
It is sure that is not possible to to set the number of frame? I remember that long time ago maybe I find something about how to set the frame's number, but
it is possible that I'm wrong.
Thank you.
Maybe you are looking for
-
Conditionally include Front Panel of a Subvi in an EXE
I want to make two versions of an EXE, one "normal" version and a debug version. I know how to set conditional disable symbols via pre/post build actions (btw. NI: these variables should REALLY be defineable per build specification; even bare command
-
Write into worksheets and close excel
can someone tells me why this doesnt work? i tried to open excel, open worksheet, write to new worksheet #2, autofit to one page for work sheet #2, write to new worksheet #3, autofit sheet #3. all those are working... but when i tried closing the ex
-
Score editor: command z, bug?
hi, I have a score with different time signatures: 3/8, 4/4, 7/7, 5/16, etc. Every time I press command+Z logic erases nearly all of my time signatures (and the last action I wanted to "undo" it isn't of course the addition of the time signatures log
-
How to check when and who uses my account?
I need to check if someone used my account in some particular days and hours. is it possible and how. thank you
-
hello, i left my ipod touch connected overnight to my playstation3 to charge and the next morning i woke up to find the ipod disabled. i put it on recovery mode and tried to restore it, but everytime itunes downloads the file, a windows pop-up appear