Search Results

Search found 37239 results on 1490 pages for 'javax swing text'.

Page 80/1490 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • I create a JPanel and GridBagLayout within an object but when I get it in the main object, attributes are missing

    - by chickeneaterguy
    public oijoij() { String name = "Jackie"; int priority = 50; int minPriority = 90; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel panel = new JPanel(); GridBagLayout gbc_panel = new GridBagLayout(); gbc_panel.columnWidths = new int[]{0,0,0}; gbc_panel.rowHeights = new int[]{0, 0, 0, 0, 0, 0}; gbc_panel.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE}; gbc_panel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; panel.setBorder(new LineBorder(new Color(0,0,0),1)); panel.setLayout(gbc_panel); panel.setAlignmentX(Component.LEFT_ALIGNMENT); panel.setMinimumSize(new Dimension(110,110)); panel.setPreferredSize(new Dimension(110, 110)); panel.setSize(new Dimension(110,110)); JLabel lblNewLabel = new JLabel("Process ID:"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.gridheight = 2; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 0; panel.add(lblNewLabel, gbc_lblNewLabel); JLabel lblNewLabel_1 = new JLabel(name); GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints(); gbc_lblNewLabel_1.gridheight = 2; gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 0); gbc_lblNewLabel_1.gridx = 1; gbc_lblNewLabel_1.gridy = 0; panel.add(lblNewLabel_1, gbc_lblNewLabel_1); JLabel lblNewLabel_2 = new JLabel("Priority:"); GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints(); gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_2.gridx = 0; gbc_lblNewLabel_2.gridy = 2; panel.add(lblNewLabel_2, gbc_lblNewLabel_2); JLabel lblNum = new JLabel(Integer.toString(priority)); GridBagConstraints gbc_lblNum = new GridBagConstraints(); gbc_lblNum.insets = new Insets(0, 0, 5, 0); gbc_lblNum.gridx = 1; gbc_lblNum.gridy = 2; panel.add(lblNum, gbc_lblNum); JLabel lblNewLabel_3 = new JLabel("Min Priority:"); GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints(); gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_3.gridx = 0; gbc_lblNewLabel_3.gridy = 3; panel.add(lblNewLabel_3, gbc_lblNewLabel_3); JLabel lblMp = new JLabel(Integer.toString(minPriority)); GridBagConstraints gbc_lblMp = new GridBagConstraints(); gbc_lblMp.insets = new Insets(0, 0, 5, 0); gbc_lblMp.gridx = 1; gbc_lblMp.gridy = 3; panel.add(lblMp, gbc_lblMp); JLabel lblTimeSlice = new JLabel("Time Slice:"); GridBagConstraints gbc_lblTimeSlice = new GridBagConstraints(); gbc_lblTimeSlice.insets = new Insets(0, 0, 0, 5); gbc_lblTimeSlice.gridx = 0; gbc_lblTimeSlice.gridy = 4; panel.add(lblTimeSlice, gbc_lblTimeSlice); Random r = new Random(System.currentTimeMillis()); panel.setBackground(new Color( r.nextInt(255 - 210) + 210, r.nextInt(255 - 210) + 210, r.nextInt(255 - 210) + 210)); } I have accessor methods for the GridBagLayout and the JPanel. When calling the functions in another file, it looks like I just get the JPanel (but without any labels or the layout or other GridBagLayout features). Help?

    Read the article

  • Java mouse motion anywhere on screen

    - by Dave
    I'm sure this is possible but all my searching is coming up blank. In Java is it possible to register for a mouse motion event outside of a Java app? So if the mouse pointer moves anywhere on the screen I get a call back. An approximation is possible with polling MouseInfo.getPointerInfo but there must be a better way. Thanks

    Read the article

  • Cannot install Visual Editor Plugin on Eclipse

    - by lyuba
    I try to follow the instructions from here to install a Visual editor pulgin for Eclipse: http://wiki.eclipse.org/VE/Update Both online and offline installations fails with the following mistake: Cannot complete request. Generating details. Here is the complete log: Cannot complete the install because of a conflicting dependency. Software being installed: Java EMF Model 1.4.0.v20090826-1446-7H-FPbAcggQleH8hJifHfUd (org.eclipse.jem.feature.group 1.4.0.v20090826-1446-7H-FPbAcggQleH8hJifHfUd) Software currently installed: Eclipse IDE for Java EE Developers 1.2.2.20100217-2310 (epp.package.jee 1.2.2.20100217-2310) Only one of the following can be installed at once: Java EMF Model BeanInfo (Introspection) Support 2.0.300.v200905030615 (org.eclipse.jem.beaninfo 2.0.300.v200905030615) Java EMF Model BeanInfo (Introspection) Support 2.0.300.R3_1_maintenance (org.eclipse.jem.beaninfo 2.0.300.R3_1_maintenance) Cannot satisfy dependency: From: Eclipse IDE for Java EE Developers 1.2.2.20100217-2310 (epp.package.jee 1.2.2.20100217-2310) To: org.eclipse.epp.package.jee.feature.feature.group [1.2.2.20100217-2310] Cannot satisfy dependency: From: Java EE IDE Feature 1.2.2.20100217-2310 (org.eclipse.epp.package.jee.feature.feature.group 1.2.2.20100217-2310) To: org.eclipse.jst.web_ui.feature.feature.group 0.0.0 Cannot satisfy dependency: From: Java EMF Model 1.4.0.v20090826-1446-7H-FPbAcggQleH8hJifHfUd (org.eclipse.jem.feature.group 1.4.0.v20090826-1446-7H-FPbAcggQleH8hJifHfUd) To: org.eclipse.jem.beaninfo [2.0.300.R3_1_maintenance] Cannot satisfy dependency: From: JST Web Core 3.1.1.v200908121609-7S7CFyvFIhIehVidwyfk0m (org.eclipse.jst.web_core.feature.feature.group 3.1.1.v200908121609-7S7CFyvFIhIehVidwyfk0m) To: org.eclipse.jem.beaninfo [2.0.300.v200905030615] Cannot satisfy dependency: From: JST Web Core 3.1.1.v200908121609-7S7CG-dFIhIeq7kV6qxaLD (org.eclipse.jst.web_core.feature.feature.group 3.1.1.v200908121609-7S7CG-dFIhIeq7kV6qxaLD) To: org.eclipse.jem.beaninfo [2.0.300.v200905030615] Cannot satisfy dependency: From: JST Web UI 3.1.1.v200908121609-7E77FBfDlwYa_9sdy2q77doi14gl (org.eclipse.jst.web_ui.feature.feature.group 3.1.1.v200908121609-7E77FBfDlwYa_9sdy2q77doi14gl) To: org.eclipse.jst.web_core.feature.feature.group [3.1.1.v200908121609-7S7CFyvFIhIehVidwyfk0m] Cannot satisfy dependency: From: JST Web UI 3.1.1.v200908121609-7E77FBiDlwYcICNdz-5z-9PGqZCy (org.eclipse.jst.web_ui.feature.feature.group 3.1.1.v200908121609-7E77FBiDlwYcICNdz-5z-9PGqZCy) To: org.eclipse.jst.web_core.feature.feature.group [3.1.1.v200908121609-7S7CG-dFIhIeq7kV6qxaLD] Has anybody encountered something like this? Appreciate your ideas!

    Read the article

  • ASP.NET with jQueryUI: text box value is getting as null in Button click event

    - by Shyju
    I have an ASP.NET page where I have a button When a user clicks on the button,I will check whether the user has logged in or not.If not logged in I will show a modal popup to login (using jQueryUI). I have placed one textbox(txtPassword) and one button(btnLogin) control in the Div which will be shown by the jQueryDialog.But in btnLogin's Click event, I am not able to read the Text value entered in the textbox txtPassword The below is my code <form id="form1" runat="server"> <div> <br /> <asp:TextBox ID="txtModelId" runat="server" Text=""></asp:TextBox><br /> <asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_Click" /> <br /> <asp:Label ID="lblUserMsg" runat="server" Text="Label"></asp:Label></div> <div id="divContentHolder"> <div class="demo"> <div id="dialog" title="Login with your TradeIn Account"> <p id="validateTips">Enter your EmailId & password</p> <fieldset> <label for="email">Email</label> <asp:TextBox ID="txtEmail" CssClass="text ui-widget-content ui-corner-all" runat="server" ></asp:TextBox> <label for="password"> <asp:TextBox ID="TextBox1" runat="server" Text="sample"></asp:TextBox>Password</label> <asp:TextBox ID="txtPassword" CssClass="text ui-widget-content ui-corner-all" runat="server" ></asp:TextBox> <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" UseSubmitBehavior="false"/> </fieldset> </div><!--dialog--> </div><!--demo--> </div><!--divContentHolder--> </form> Server side Code protected void btnGo_Click(object sender, EventArgs e) { CheckUserLoggedIn(); } private void CheckUserLoggedIn() { if (Session["username"] != null) { Response.Write("Logged in user"); ClientScript.RegisterHiddenField("isAuthenticated", "true"); } else { ClientScript.RegisterHiddenField("isAuthenticated", "false"); } } protected void btnLogin_Click(object sender, EventArgs e) { string txtSample= TextBox1.Text; // this is showing the value 'sample' string txtPass= txtPassword.Text; // this is showing null if (txtPass == "shyju") { Session["username"] = txtPassword.Text; Response.Redirect("TestingModal.aspx"); } } My java script code to render the dialog $(function() { var name = $("#name"), email = $("#email"), password = $("#password"), allFields = $([]).add(name).add(email).add(password), tips = $("#validateTips"); function updateTips(t) { tips.text(t).effect("highlight",{},1500); } function checkLength(o,n,min,max) { if ( o.val().length > max || o.val().length < min ) { o.addClass('ui-state-error'); updateTips("Length of " + n + " must be between "+min+" and "+max+"."); return false; } else { return true; } } function checkRegexp(o,regexp,n) { if ( !( regexp.test( o.val() ) ) ) { o.addClass('ui-state-error'); updateTips(n); return false; } else { return true; } } $("#dialog").dialog({ bgiframe: true, autoOpen: false, height: 300, modal: true, buttons: { 'Create an account': function() { var bValid = true; allFields.removeClass('ui-state-error'); bValid=true; if (bValid) { /*$('#users tbody').append('<tr>' + '<td>' + name.val() + '</td>' + '<td>' + email.val() + '</td>' + '<td>' + password.val() + '</td>' + '</tr>'); */ alert("Check User Credentials") $(this).dialog('close'); } }, Cancel: function() { $(this).dialog('close'); } }, close: function() { allFields.val('').removeClass('ui-state-error'); } }); $('#create-user').click(function() { $('#dialog').dialog('open'); }) .hover( function(){ $(this).addClass("ui-state-hover"); }, function(){ $(this).removeClass("ui-state-hover"); } ).mousedown(function(){ $(this).addClass("ui-state-active"); }) .mouseup(function(){ $(this).removeClass("ui-state-active"); }); var isAuthenticated = $("#isAuthenticated").val(); if (isAuthenticated && isAuthenticated == "false") { // Display the modal dialog. $("#dialog").dialog("open"); } }); I had hard coded the text properties value of TextBox1 as 'sample' in the HTML part of my ASPX file .In button click event i am getting it.But the other textbox,txtPassword 's Text property is giving me null value Please guide me to go ahead Thanks in advance

    Read the article

  • How can I set size of a button?

    - by Roman
    I put my buttons in a JPane with GridLayout. Then I put JPanel into another JPanel with BoxLayout.Y_AXIS. I want buttons in the GridLayout to be square. I use tmp.setSize(30,30) and it does not work. I also try to use new GridLayout(X, Y, 4, 4) but I cannot figure out what X and Y are. So, what is the correct way to do this stuff?

    Read the article

  • Creating JTable Row Header

    - by Chandu
    Hi all, I'm new to JTable.I'm working in Swings using JTable & Toplink(JPA). I have two buttons "add Row", "Del Row" and I have some records displayed from db. when ever "add row" is clicked a new record, row header should be added to JTable with an auto increment number displayed in sequential order to the JTable Row Header. During deletion using "Del row " button the record has to be deleted & not its corresponding header so that next rows got updated to the previous headers & the auto increment number remain unchanged and always be in sequence. please help me on this regard. Thanks in advance, Chandu

    Read the article

  • Netbeans jar file icon problems

    - by Erma
    I finally found how to make an exe project in Netbeans, so a jar file and execute it from the DESKTOP. The only problem I have ocurred is that after I open the jar file and login with my username and password the button icons are not shown, if I put a string it appears but if I put the image it doesn't appear. So,I had to restore this code: JButton btnNew = new JButton(new ImageIcon("new.gif")); JButton btnUpdate = new JButton(new ImageIcon("NotePad.gif")); JButton btnDelete = new JButton(new ImageIcon("delete.gif")); JButton btnSearch = new JButton(new ImageIcon("find.gif")); and put this one: JButton btnNew = new JButton("ADD"); JButton btnUpdate = new JButton("Update"); JButton btnDelete = new JButton("Delete"); JButton btnSearch = new JButton("Search"); It now works but I would like to have the icons please. Any idea?

    Read the article

  • adding jpanel into a jframe. netbeans

    - by stdnoit
    i am particularly using netbeans gui editor and i am new to gui i have a jframe created and I added jtabbedpanel. inside the jtabbedpanel i have 2 panels that i call standard and compact i have set standardPanel = new ImagePanel(); which ImagePanel.java is located on different java file how am I suppose to put a panel on different file for reusability ? i obviously dont want all the codes in a single file. is this the right way to design a gui ? thanks

    Read the article

  • Draw a JButton to look like a JLabel (or at least without the button edge?)

    - by Electrons_Ahoy
    I've got a JButton that for various reasons I want to act like a button, but look like a JLabel. It doesn't actually have to be a JLabel under the hood, I just don't want the raised button edge to show up. Is there an easy way to turn off the "button look" for JButtons but keep all the button functionality? I could build some kind of composed subclass hyperbutton that delegated to a jlabel for display purposes, but I'm really hoping there's something along the lines of button.lookLikeAButton(false).

    Read the article

  • Why is JFormattedTextField evil?

    - by kwutchak
    Hi, In this question Is there any way to accept only numeric values in a JTextField? one of the answers suggested that JFormattedTextField had issues. I've not yet used it, but could somebody please expand (or disagree) on the issues with this class? Thanks...

    Read the article

  • Adding a JLabel to JLayeredPane from event listener not dragging.

    - by Cody
    Ok, So for some reason When I add components to a JLayeredPane in its constructor: JLabel label = new JLabel(); label.setSize(100,100); label.setText("This works"); add(label); It works perfectly fine, but If a add it later in the JLayeredPane's parent EDT it doesnt let me move the objects around but they let me see the objects. Adding from EDT: JLabel label = new JLabel(); label.setToolTipText(url.getHost()); label.setIcon(icon); label.setBorder(new LineBorder(null)); label.setSize(icon.getIconWidth(), icon.getIconHeight()); dressFrame.layeredPane.add(label, JLayeredPane.DRAG_LAYER); Dragging method: Component c = findComponentAt(e.getX(), e.getY()); if (c instanceof JLayeredPane) { pieceSelected = false; return; } Point parentLocation = c.getLocation(); xAdjustment = parentLocation.x - e.getX(); yAdjustment = parentLocation.y - e.getY(); movingPiece = c; movingPiece.setLocation(e.getX() + xAdjustment, e.getY() + yAdjustment); pieceSelected = true;

    Read the article

  • Managing string resources in a Java application - singleton?

    - by Joe Attardi
    I seek a solution to the age-old problem of managing string resources. My current implementation seems to work well, but it depends on using singletons, and I know how often singletons can be maligned. The resource manager class has a singleton instance that handles lookups in the ResourceBundle, and you use it like so: MessageResources mr = MessageResources.getMessageResources(); // returns singleton instance ... JLabel helloLabel = new JLabel(mr.getString("label.hello")); Is this an appropriate use of a singleton? Is there some better, more universally used approach that I'm not aware of? I understand that this is probably a bit subjective, but any feedback I can get would be appreciated. I'd rather find out early on that I'm doing it wrong than later on in the process. Thanks!

    Read the article

  • Java: Altering UI fonts (Nimbus) doesn't work!

    - by ivan_ivanovich_ivanoff
    Hello! I'm referring to this Nimbus reference. I tried to set global Font to be slightly larger: UIManager.put("defaultFont", new Font(Font.SANS_SERIF, 0, 16)); ...works only for the menu but nothing else (buttons, labels). I tried to change labels and buttons fonts with UIManager.put("Button.font", new Font(Font.SANS_SERIF, 0, 16)); UIManager.put("Label.font", new Font(Font.SANS_SERIF, 0, 16)); but the font remains. The only thing that worked for me was deriving a font: someButton.setFont(someButton.getFont().deriveFont(16f)); But this is not an option, since this must be done for each element manually. Note, that deriving a font for UIManager doesn't work either: UIManager.put("Label.font", UIManager.getFont("Label.font").deriveFont(16f)); I tested everything under Linux and Windows: same behavior. I just can't understand how an API can be so messy. If a method is called setFont(..) then I expect it to set the font. If this method fails to set the font in any thinkable circumstances, then it should be deprecated. EDIT: The problem not only applies to Nimbus, but also to the default LAF.

    Read the article

  • Resizing JPopupMenu and avoiding a "flicker" issue

    - by Avrom
    Hi, I am trying to implement a search results popup list similar to the style found here: http://www.inquisitorx.com/ (I'm not trying to implement a Google search, I'm just using this as a rough example of the style I'm working on.) In any event, I am implementing this by using a JList contained within a JPopupMenu which is popped up underneath a JTextField. When a user enters search terms, the list changes to reflect different matching results. I then call pack on the JPopupMenu to resize it. This works, however, it creates a slight flicker effect since it is actually hiding the popup and showing a popup. (See the private method getPopup in JPopupMenu where it explicitly does this.) Is there any way to just get it to just resize itself (aside from using a JWindow)?

    Read the article

  • Drawing star shapes with variable parameters

    - by owca
    Hi. I have task to write program allowing users to draw stars, which can differ in size and amount of arms. When I was dealing with basic stars I was doing it with GeneralPath and tables of points : int xPoints[] = { 55, 67, 109, 73, 83, 55, 27, 37, 1, 43 }; int yPoints[] = { 0, 36, 36, 54, 96, 72, 96, 54, 36, 36 }; Graphics2D g2d = ( Graphics2D ) g; GeneralPath star = new GeneralPath(); star.moveTo( xPoints[ 0 ], yPoints[ 0 ] ); for ( int k = 1; k < xPoints.length; k++ ) star.lineTo( xPoints[ k ], yPoints[ k ] ); star.closePath(); g2d.fill( star ); What method should I choose for drawing stars with variable inner and outer radius, as well as different amount of arms ? This is what I should obtain :

    Read the article

  • Can Box Layout accept size of included elements?

    - by Roman
    I used myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS)); to order panels vertically (one under another one). But myPanel defined in the shown way change the included panel. In more details, it tries to set the same hight and width for the included panels. Can it be changed? Can BoxLayout adopt size of the included elements?

    Read the article

  • How do I properly display all content in a JTabbedPane?

    - by maleki
    I am nesting a JPanel inside a JTabbedPane. I am having trouble displaying all the content inside of the JTabbedPane. The outside borders of the internal content get chopped off. I am currently not using a Layout Manager for my JTabbedPane or dummy Panel because it stretches my content automatically. How do I add a JPanel inside the JTabbedPane so that I can have an even border around all the content.My attempts to create a dummy panel and setting a border for the inner panel using BorderFactory haven't worked. Is there a convention that I need to know to do this correctly? JTabbedPane tabPane = new JTabbedPane(); GridPane tab1 = new GridPane(); GridPane tab2 = new GridPane(); tabPane.add("My Pieces",tab1); tabPane.add("Opponent Pieces",tab2); public class GridPane extends JPanel { public GridPane() { this.setPreferredSize(new Dimension(400,160)); this.setLayout(new GridLayout(4,10)); this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); for (int i = 0; i < 4; i++) { for (int j = 0; j < 10; j++) { boardSquares[i][j] = new JPanel(); boardSquaresArr.add(boardSquares[i][j]); this.add(boardSquares[i][j]); } } } }

    Read the article

  • JOptionPane to appear on selected JCheckBox

    - by Venno
    Hi all I am having some difficulties with adding a joptionpane in JcheckBox listener public void itemStateChanged(ItemEvent evt) { if(evt.getStateChange() == ItemEvent.SELECTED){ ///some code JOptionPane.showMessageDialog(null, "Message", "Alert", JOptionPane.INFORMATION_MESSAGE); } } so it works fine,but the problem is that the JCheckBox gets selected and immediately deselected how can I manage to fix this ? Cheers

    Read the article

  • Java2d: Set gradient for a lines

    - by Algorist
    Hi, I am having multiple points in a plane and some hundreds of lines pass through those points. Some points can have more lines passing through them than other points. I want to show some kind of more gradient or brightness associated with lines crowded together. Is this possible to do in java2d. Please refer to this : http://ft.ornl.gov/doku/_media/ft/projects/paraxis.jpg Thank you.

    Read the article

  • Java MouseEvents not working

    - by billynomates
    This may be a stupid question, but I have to ask! I have the following code snippets that are supposed to run their corresponding methods when the user interacts with objects. For some reason, "foo" is never printed, but "bar" is. myJSpinner1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt() { System.out.println("foo"); //"foo" is not printed } }); myJSpinner2.addChangeListener(new java.awt.event.ChangeListener() { public void stateChanged(java.awt.event.ChangeEvent evt() { System.out.println("bar"); //"bar" is printed } }); I get no exceptions or stack trace. What am I missing in the MouseListener one? Thanks in advance.

    Read the article

  • Changing content of HTMLDocument displayed in a JTextPane

    - by kayahr
    I'm displaying some tables as HTML code (rendered by a Freemarker template) with a JTextPane. I also have some HTML links in this HTML output which can be used to interact with the values of the table (For example "Delete a row" and stuff like this). Currently I always recreate the whole HTML output on each change and replace the whole document in the JTextPane with the new one. This is getting really slow and the JTextPane always changes the scroll position when I do this. Is it possible to change only parts of the HTML code during runtime without replacing the whole document? In a real browser I would use the DOM and do something like document.getElementById("price").innerHTML = "$123.44". Is something like that possible with the HTMLDocument in a JTextPane?

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >