1. How to place stuff without a layout? coderanch.comHi I want to make a frame that holds a panel, that hold some buttons, and I want to control where those buttons should be myself. They only way I found that possible was by using setLayout(null), and my code looks something like this: JFrame frame = new JFrame("My Gui"); frame.setBounds(50,50,500,500); JPanel myPanel = new JPanel(); myPanel.setLayout(null); JButton b = new ... | |
2. help with Layout managers coderanch.comI have this code in which the circle overlaps the polar chart and a slider and textfield.I'm was using BorderLayout so far.But now I am unable to add another component on the frame.Please help me which layout manger i should use to add 2-3 buttons on the right and left side of the frame. here's the code.What changes should i do? ... | |
3. basic swing layout problem. coderanch.comhow do i get my button to be 22 in height and use all width available to it? also i would like to align my label to the left... Thank you. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package erasemejavaapplication2; /** * * @author ferdna */ import javax.swing.*; import ... | |
4. Simple java layout question coderanch.compublic class ProfileTest extends JPanel { public ProfileTest() { super(new BorderLayout()); JPanel profilePanel = new JPanel(new BorderLayout()); JPanel buttonsPanel = new JPanel(new GridLayout(2,2)); JLabel optBatchLabel = new JLabel("Optimum Batch Size"); JTextField tf = new JTextField(); JRadioButton pagesRadio = new JRadioButton("Pages",true); JRadioButton notificationsRadio = new JRadioButton("Notifications",false); buttonsPanel.add(pagesRadio); buttonsPanel.add(tf); buttonsPanel.add(notificationsRadio); buttonsPanel.setPreferredSize(new Dimension(100,100)); //Thought this might have worked but no profilePanel.add(optBatchLabel,BorderLayout.NORTH); profilePanel.add(buttonsPanel,BorderLayout.CENTER); profilePanel.setPreferredSize(new Dimension(900,900)); ... | |
5. Implementing drag in custom layout manager coderanch.comHello Carvel, Drag and drop is a rather hairy and ugly beast in Java. However, before diving into it, why don't you place a JSplitPane between each of the sections? Or I suppose you can add a mouse drag listener to your divider component, and then change the components Y location based on where the mouse moves. BTW, if you are ... | |
6. scalable layout for a desktop application coderanch.com | |
7. Layout problem with the gaps coderanch.comHi i have one rutien problem i use the GridLayot and i want to set a space betwean the JLabels in the aplication. When i chainge the gaps i only chaige the JTextField space The oder problem is haw to set the 4 buttons in the right corner i use the FlowLayout i dont know what actualy to do /* This ... | |
8. How to set Layout ? coderanch.comHi Members, This is my code for designing a simple window . In this I used GridLayout (some other also).But fail to fix it .Here I used the same thing in above panel but I do not know that why is it not working in the second panel ? Here is my code public class MyGridBagTest extends JFrame { private boolean ... | |
9. What's the best layout for this? coderanch.com | |
10. help in layout managers. coderanch.comHi, I'm implementing a code in that I have to use Swing. Please help regarding layouts. I have to show a dialog in that I have to show one panel and in panel I'm going to use different cards. so for dialog which layout I should use to hold the panel. In cards I have to show buttons at particular location ... | |
11. problem in layout coderanch.comHi, I'm using Grid layout in that i have used a panel to show image on top side . after that there are few buttons in the screen which are below the image. all buttons are properly managed but the image shown in the panel is getting cropped. I'm not getting what is happening please help me out. thanks | |
12. Layout Managers & Proper Spacing coderanch.comSo, I have a simple GridBagLayout setup with three columns. In the top center column, I have a label with the title. In the second, third, and fourth rows, I have a label in the first column and a textarea/textfield in the second two columns. Finally, on the bottom, I have a button in each column. My problem is that the ... | |
13. How to get a liquid layout? coderanch.comnowadays most web pages are liquid, i mean, when resized they display gracefully in my case i would like this textarea to extend itself as one resizes the window horizontally i would apreciate any advice on how to achieve this (like the first case in the code bellow), though i only need horizontal elasticity when i run the second case the ... | |
14. How can I achieve this layout? coderanch.com | |
15. layout coderanch.comhey, i am making a virtual map software that is for a pda, or android phone etc. and i was wondering what was the best way to make the main menu, the only idea i have got is just the buttons (which are map, organiser, settings, logout) in a vertical column down. i was wondering if anybody had any better ideas ... | |
16. problem with layout coderanch.comI am new to swing programming. I am trying to create a layout for a small Examination. It should be in the following manner _______________________________________________________________ Question 1 : | |
17. gef layout coderanch.comHi guys, I have trouble with gef layout. I have a map storing some key-value pairs, and I want to display all of them. some of them have connections and some of them do not have. The number of values in the map varies in the run time. so I need to auto arrange all the nodes in the editor. anyone ... | |
18. Outline Issue with Custom Layout Manager coderanch.comOkay, but I'm not sure where the problem is, if there's a problem that I can correct? I'm guessing it's in here: public void layoutContainer(Container parent) { Point center = new Point((int)parent.getWidth()/2,(int)parent.getHeight()/2); Point thisPoint; int x, y, w, h, s, c; int n = parent.getComponentCount(); Component comp = null; Dimension compPS = null; if (n == 1) { comp = parent.getComponent(0); ... | |
19. Layout Managers coderanch.com | |
20. Question abt Layout Mangers coderanch.com | |
21. Layout problem using AWT coderanch.comHi All I have small problem with AWT while arranging buttons. I want to arrange one text field in one line , and next all lines will be followed by buttons like calculator. I can able to show buttons as i like but text field is not showing appropriately. here is my code : import java.awt.Button; import java.awt.FlowLayout; import java.awt.Frame; import ... | |
22. layout Problem coderanch.com | |
23. Question about layout coderanch.com> Well, I am thinking of using BorderLayout (which I am only familiar with) to do it. But I found it kind of troublesome. only 2 borderLayout panels are required, so it has to be a lot easier (less troublesome) than a GridBagLayout. simple demo (titledBorder code only to show where they are) import java.awt.*; import javax.swing.*; import javax.swing.border.*; class Testing ... | |
24. Best place to share custom layout manager coderanch.com | |
25. Why does the FlowLayoutManager layout more space than needed? coderanch.comimport java.awt.*; import java.applet.*; class TheGame extends Canvas { public TheGame() { setBackground(Color.RED); } } public class Bustup extends Applet { public Panel pnlGame = new Panel(); public TheGame cnvGame = new TheGame(); public Panel pnlControls = new Panel(); public Panel pnlStatus = new Panel(); public Button btnStart = new Button("Start"); public Button btnPause = new Button("Pause"); public Button btnReset = ... | |
26. Which layout manager to learn to use coderanch.com | |
27. Layout opinions coderanch.comI have gotten a lot of help and great tips from you guys over the course of these last few weeks, but I have a question. On multiple occasions I have been advised not to use a null layout for mu programs. Now that I have a little extra time to look into other types of layouts, I have to ask ... | |
28. Swing desktop apps descriptive layouts. Are they worth the trouble? coderanch.comHi, I would like to ask what is your opinion on Swing applications which construct the GUI via xml files that describe the layout. For me it seems too much tedious. I understand that you can change the GUI by updating the configuration file, but I am not sure if this is worth the trouble. Am I wrong? Is this approach ... | |
29. Problem with Layouts coderanch.com | |
30. Layout Manager Question(s) coderanch.comimport javax.swing.JApplet; import javax.swing.JPanel; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import javax.swing.JScrollPane; public class buildTree extends JApplet { int sOverallWidth = -1; int sOverallHeight = -1; public void init() { try { sOverallWidth = Integer.parseInt(this.getParameter("width")); } catch (Exception exr) { sOverallWidth = 1200; } try { sOverallHeight = Integer.parseInt(this.getParameter("height")); } catch (Exception etr) { sOverallHeight = 1200; } JPanel treeStructure = new JPanel(); ... | |
31. Layout managers and JNLP...do they blend? coderanch.com | |
32. What is the best Layout? coderanch.comPeople are going to it isn't one, but I like to use null. Layouts are kinda hard to understand and use. You can specify EXACTLY where you want with the setBounds(int x, int y, int width, int height) method. Here it is: http://download.oracle.com/javase/1.5.0/docs/api/java/awt/Component.html#setBounds(int, int, int, int) You just have to specify in the beginning: jframe.setLayout(null); OR window.setLayout(null); OR jwindow.setLayout(null); or whatever ... | |
33. Which Layout to use coderanch.com | |
34. Manage Layouts in java coderanch.comHi, I am using eclipse. Using this I can develop swing interfaces (using UI editor). In netbeans also I can developed the interfaces. but the problem is in eclipse I have to set the layout. In netbeans do not need to set the layout. The advantage in netbeans is we can design the interface freely and after execute if we click ... | |
35. Which layout manager should i use? coderanch.comHi friends, I am new to AWT, I was practicing AWT to make some GUI which later i should modify and use in my project. I saw a GUI in one website and was planning to design like that, but i am not sure which layout manager i should be using. Attaching an image of the same. | |
36. Require Help with Layout (GridBag) java-forums.orgHello All, I need help with GridBagLayout. I get stuck until this stage many times and would not know how to proceed further. I need help on laying out the components according to the Layout as attached. WIth the solution given this time I will look into it more deeply and analyse where I went wrong. Please help. Code is Shown ... | |
37. Gridbag layout java-forums.orgFubarable is correct about cross-posting. We also don't provide code. Write some code, post it if you don't understand something specific, and we can try to help you. GridBagLayout is very powerful, and I'm sure you can use it produce your desired layout. Check out Sun's tutorial, and experiment. If you are not using an IDE, I suggest getting Netbeans and ... | |
38. Need Suggestions on layout management java-forums.orgI am learning Java on my own. I working on swing, and am developing an RPN calculator as an exercise. I coded a working version using netbeans, and am hand coding the GUI in eclipse. I used the gridbag layout manager in the hand coded version. Both versions look like they were built laid out with crayons. To wit, the buttons ... | |
39. Use the Layout in java java-forums.orgpublic class test extends JFrame { private JPanel Pane; private JLabel Label1,Label2,Label3,Label4,Label5,Label6; public test() { setSize(300,200); setLayout(new GridLayout(1,1)); Pane = new JPanel(); Pane.setLayout(new GridLayout(2,3)); Label1 = new JLabel("1"); Pane.add(Label1); Label2 = new JLabel("2"); Pane.add(Label2); Label3 = new JLabel("3"); Pane.add(Label3); Label4 = new JLabel("4"); Pane.add(Label4); Label5 = new JLabel("5"); Pane.add(Label5); Label6 = new JLabel("6"); Pane.add(Label6); add(Pane); } public static void main(String[] args) ... | |
40. How does the programmer invoke a different layout manager java-forums.org | |
41. How to change the Look & Feel Layout java-forums.org | |
42. java on mac - gui layout problem java-forums.orgI am working on an application that uses a GUI and works well on linux and windows, but there is a problem on mac. The layout of the GUI is not as desired. The main JFrame uses a BorderLayout, and there is a JPanel in the CENTER region, a toolbar in the NORTH region, and a JTabbedPane in the EAST region. ... | |
43. How to set layout to have correct output java-forums.orgI have to create a frame with tabs. So I have lots of labels and fields. I tried many layouts(like Grid, GridBag, Boarder, Flow) for setting them in different tabs. But I couldn't get satisfactory results. Below is the code for one of the tab :- Java Code: class SCGUI extends JPanel { public SCGUI() { JPanel mainPanel = new JPanel(); ... | |
44. Which Layout should use for Creating multiline fill in the blanks. java-forums.orgI am getting a string from database which has a question in the format given below: void main(){/n int a,b;\n printf("___",a+b);\n } And i have to show this question in format void main() { int a,b; printf(" | |
45. any layout that uses exact coordinates java-forums.orgHi All I am working on an AWT application and I need some sort of layout manager that lets me specifiy exact coordinates where I need my components to be placed inside the panel. The only platform my application will run will be windows so I am not really concerned about portability. any ideas ?? many thanks in advance :) | |
46. looking for a layout java-forums.orgI'm currently making a tower defence game. Visually, this is going to be a "playingfield" where all the action happens and some buttons and textfields etc. below that to give the player some extra options. I'm curently developing the "editor mode" first because it is simpler because it hasn't got moving monsters and shooting tower. Also the game class itself will ... | |
47. Swing Html Layout java-forums.orgHi Frens, I am new to swing. i wanna do dynamic screen design for my desktop application. i have tried out xito-table layout in swing. In that Api we can mactch the html values to swing components. but i can not apply the styles for that layout. is there any possible ways to achieve my goal? | |
48. repaint validate doLayout java-forums.orgpaint is a container method which receives a graphics context and is used to render a container and all of its children repaint is what we use in event code to ask a component to re-render itself update: used in AWT drawing to avoid flicker; its use in Swing is not recommended/needed. validate - container AWT method which we call when ... | |
49. Please Help me to do a layout java-forums.org | |
50. Layout problem java-forums.orgI have been experimenting with layouts (border, flow, grid), but I still don't know how to get the result from my task. My task is to organize components in a way shown in the attached picture. (calc.jpg) To be precise, while resizing a window horizontally components mustn't change their width, and space between all of the components has to be equal. ... | |
51. Gridbag Layout Probelm java-forums.orgHi, I am a student and have to submit a Mail Program. I have been asked to do the program using GridBagLayout. The program is working fine but for the Layout. I just am not able to manage the layout problems I am facing in this program. Could I get some help to set this right. I don't want to use ... | |
52. Reccomended Layout? java-forums.orgAlright, so I've made a Scrabble game and am trying to figure out the best layout possible for it. There's three graphics panels -- 1 for the game (it's about 600 pixels by 600 pixels) and 1 for each hand (each 210 x 30 pixels). In additions, there's a button to end your turn, and a panel with a set of ... | |
53. Swing layouts java-forums.orgpublic void createConfig(){ configPanel = new JPanel(); portNumber = new JTextField(5); friend = new JTextField(5); ipAddresText = new JTextField(5); connect = new JButton("Connect"); JLabel portNumberLabel = new JLabel("Enter port number"); JLabel friendLabel = new JLabel("Enter name"); JLabel ipAddress = new JLabel("Enter ip address"); JLabel onlineFriends = new JLabel("Friends"); configPanel.setLayout(new BoxLayout(configPanel, BoxLayout.Y_AXIS)); configPanel.setSize(500,500); configPanel.setBackground(Color.LIGHT_GRAY); //configPanel.add(portNumberLabel); //configPanel.add(portNumber); //configPanel.add(friendLabel); //configPanel.add(friend); //configPanel.add(ipAddress); //configPanel.add(ipAddresText); Dimension dimension ... | |
54. Simple Layout Question java-forums.orgHello, I have just recently started learning about JButtons, panels etc. What I am struggling with is getting them to be positioned on the screen where I want them. Here is a very simple code which currently displays 2 buttons next to each other in the top left corner of the screen. My question is: how would I get the second ... | |
55. Layout help java-forums.orgI need help with layouts. I need a simple layout of some kind, which allows me to put objects at x,y place. Or a layout that allows me to put a gap of space between objects, that needs to be horizontolly and vertically, I tried GridConstraints and layout, I tried to to use a Separator, but nothings seems to work ok. ... | |
56. Layout Manager suggestion java-forums.orgHi Everyone; I'm fairly new to Java and, after going through Sam's teach yourself java in 24hrs, I'd like to make my own calculator. I have aheavy background in web programming and I find this new way of "styling" really awkward so I'm looking for suggestions/pointers on how to layout my calculator and their components. This is what I want it ... | |
57. Layout Managers java-forums.org | |
58. trouble with layout managers java-forums.orgtrouble with layout managers ok, so here my new problem. Originally, I used the getContentPane of JFrame, set it to GridLayout, and added my class SquarePanel, which extends JPanel and has a paintComponent method that looks like this: Java Code: public void paintComponent(Graphics g) { super.paintComponent(g); int width = getWidth(); int height = getHeight(); if(color == Colors.WHITE) g.setColor(Color.white); else ... | |
59. Layout manager for a very simple problem! java-forums.org | |
60. JAVA GUI Layout problems... java-forums.orgHello, so I have a problem with my Swing GUI, I'm trying to create a whiteboard application with a label, then lower the white drawing area (400x250 pixels) and at the bottom 3 buttons, to choose the pen color, well, it doesn't work, what happens is you can just see the three buttons in the gui, so can anyone tell me ... | |
61. Layouts java-forums.orgHello everyone, I've stopped working with gui for the last few months because I my basic java knowledge was rusty. Now after a while I'm feeling that my base has expend and I'm ready to start writing gui programs properly. I got to know most of the component sub-classes but I have to say it was a nightmater to code without ... | |
62. Layout manager java-forums.orgI want to create a gui window which should looks like a login page of a website. in the first row, a JLabel and a JTextField should be there to enter the username. in the second row, another JLabel and a JPasswordField should be placed to enter the password. in the third row, a login button should be placed. I created ... | |
63. Help with layout managers java-forums.orgHi, I'm having trouble understanding how layout managers work. I understand how they work in principle but when it comes to managing the size of the layout and its contained components I'm at a loss. Here's an example: I have one panel with a BorderLayout. Inside this panel I have placed a label in NORTH and a button in the SOUTH. ... | |
64. Can you have multiple layouts using swing? java-forums.orgi have what i want to do planned out , in another thread right now "combining these 2 projects" . Right now im just playing with adding components . Im looking over the dif layouts and i like the border layout for the project im working on and but, idk if you add the tabs to the layout or the layout ... | |
65. Add Swing Layout.jar java-forums.org | |
66. Swing layout is done wrong java-forums.orgHello, I have a custom JPanel which represents a simple chat user interface. With userlist, messages and input. Here is the code so far: Java Code: public class ChatPanel extends JPanel{ private JTextArea ta_chat; private JList l_users; private JScrollPane sp_chatscroll, sp_listscroll; private JTextField tf_chatenter; private Vector | |
67. Simple GUI layout manager java-forums.orgimport java.awt.*; import java.awt.event.*; import javax.swing.*; public class Layoutdemo2 { public static void main(String [] args) { MyFrame frame = new MyFrame("Alan Window"); frame.setSize(400, 300); frame.setLocation(100, 75); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } class MyFrame extends JFrame { JTextField txt1 = new JTextField("One"); JTextField txt2 = new JTextField("Two"); JTextField txt3 = new JTextField("Three"); JPanel txtpan1= new JPanel(); JButton btn1 = new JButton("btn1"); JButton ... | |
68. Need Swing Layout Advice java-forums.orgI'm creating a Java app that is going to be used as a survey tool. I'm creating the user interface based on XML data. I'm thinking each question will have it's own panel and then I'd like to stack the panels on top of each other. Ideally I'd like scroll bar so I can keep the window size constant. Is there ... | |
69. help with swing layout java-forums.orgI have the code below that's supposed to add a bunch of buttons and also a label that olds the results of the calculations. The numbers are other buttons show up, but for some reason the label is not showing up. Is there something I'm forgetting? Java Code: import java.awt.*; import javax.swing.*; public class superCalc extends JFrame { public static void ... | |
71. Swing layout books ? forums.oracle.comHi, We are a small group of developers and have written quite a lot of Java apps and GUIs, but seems to struggle sometimes getting good layouts on forms etc that we are designing. We obviously know about the different layout managers but i'm not sure we're using them fully or really know them inside out. What we're looking for is ... | |
72. Swing question -- build gui in constructor? best layout? forums.oracle.comdid you remember to call super() in your constructor? . I am in favor of building the GUI object in the consturctor. . The best thing for building good GUI's is to know convention and acceptable contrast; you can build garbage with the best tools and you can build the best GUI's with just the bare fundamentals--it's all in the builder's ... | |
73. GUI Layout forums.oracle.comimport javax.swing.*; import java.awt.*; public class InputWindow extends JFrame { private JPanel panel = new JPanel(); private JButton inputButton = new JButton("Input"); private JLabel rainfallLabel = new JLabel("Rainfall: "); private JLabel rainfallUnitLabel = new JLabel("mm"); private JLabel wheatLabel = new JLabel("Wheat Price: $"); private JLabel barleyLabel = new JLabel("Barley Price: $"); private JLabel sorghumLabel = new JLabel("Sorghum Price: $"); private JTextField ... | |
74. Problem with GUI Layout forums.oracle.comHi all, Im a newbie to this java programming. I want to do a simple slider tile game. I went through quite a bit of tutorials on this, and manage to finish painting the tiles onto my JFrame. However, my tiles only works with GridLayout and not null layout. What I understand is that all graphics should work with null layout ... | |
75. using Java swing layout forums.oracle.comHopefully you have some idea of where i'm heading. I don't want a table because i want this to be uneditable so i'm doing with with panels. the spots marked "JButton" are of course Buttons (their functions are not important). at the bottom is a single "OK" Jbutton that is aligned with the other JButtons above it. my issues are as ... | |
76. Unable to run jar file without lib folder containing swing-layout-1.0.jar forums.oracle.comWhen you develop GUI applications using the Netbeans you may endup using netbeans specific jar files in your auto generated code. And when you build jar files with netbeans it copy the third party jar files used in a application in to a lib folder in the same directory as the jar file of your project. And then set a class ... | |
77. Netbeans 5.0 swing-layout jar file forums.oracle.comHi I have my project in a jar file. it uses the new netbeans layout contained in: c:\Program Files\netbeans-5.0\platform6\modules\ext\swing-layout-1.0.jar The above directory is correctly in my classpath. When I run : c> java -jar Menu.jar it can't find GroupLayout which is supposed to be in org/jdesktop/layout/ under the swing-layout-1.0.jar file ?? Am I missing something here? Thanks | |
78. help with GUI layout forums.oracle.com | |
79. swing-layout source forums.oracle.comHello, Im using java 1.4, and use the swing-layout.1.0.jar for our gui, so that we could create it using a GUI builder. swing-layout is under the LGPL so I need to supply the source with it if I am correct, but I am unable to find the source code anywhere, does anyone know where I can find it? Many Thanks James ... | |
80. Need help in Swing and Layouts forums.oracle.comHi buddies i need a help am doing a small application and using gridbag layout for that and when i tried to use weightx that value is applied to all the components but i just want to give that value for a single component , then how to set the length for combobox like setting for textfield new textfield(30) pls.let me ... | |
81. GUI Layout - HELP!!!! :) forums.oracle.comThis is a bit messy. Here are my reasons to say this: - Your code mixes AWT and Swing(Label and JButton); - Are you sure there is a font called Ariel or you meant Arial; - getContentPane() and this.add(...)? What do you mean by that? What did you extend - JFrame or Frame? Mike | |
82. about swing-layout-1.0.jar ??? forums.oracle.comYou can use something like Fat Jar to combine them (or just jar xvf swing-layout-1.0.jar and mix the class files in with your class files before you make main.jar... I wouldn't recommend that though) Although I must say you shouldn't have to move the jar file around if you've got things set up correctly. You can specify the required libraries in ... |