Customize a JMenuItem

Is there an easy way to create a new JMenuItem which displays the following components:

<icon> <text> <icon>

so far I have created everything by myself, by overriding the paint method, etc, but it's not really nice, and still doesn't work quite well...

any Idea ?

Souk

  • "

    Swing / AWT / SWT / JFace

    " Open Questions
  • Customization of JTextField for Date####
  • Hi,I want to customize the JTextField for getting in the Date as input in format MEDIUM.(14.04.2002). The textfield shoud always look like |.. | so that the user can directly type in the numericals. While typing the dots should not be disturbed. Please help me with the tips or code u have.With ...
  • customising scroll policy for a TabbedPane
  • I am trying to develop a tabbed pane which shall have two different type of tabs suppose A and B , the tab B will get added more nad more in response to some action, i am able to do all those but i want that when the tab numbers increase, the scrolling should be only for the Tabpane of type B, ...
  • Customising - JColorChooser
  • I am trying to incorporate colour selection into a program.At the moment this is done by using an AbstractColorChooserPanel,(the initial panel shown by the JColorChooser object) However i don't want the user to see the RGB values of the colours they select. Is there any simple way of not ...
  • Customised Tree
  • Normally Swing tree is like the one below.(Hyphens are added to view properly) -root1stchild 2ndchild3rdchild4thchildchildren are added in next column and increasing rows downwards.Is a Tree possible where children are added on both sides of root. not only in next column .but in previous ...
  • Customised Layout Manager
  • Hi all,if anyone can help with with this you are a genius.I would to create a layout manager that is similar to the GridLayout. All the components in the Gridlayout are of the same size, however I would like to resize my components and make them any size i wish. I'm more concerned about the...
  • Customise JOptionPane
  • I ned a confirm optionpane with white backgraoud ,black text with Monospaced font . But my attempts to customize the option pane never goes through .Why ?Is there a way I can achieve this ?---My code public int onWindowClose(){ message="Do you want to Exit Dictionary Admin ?"; messageType=JOpt...
  • customise a jtooltip
  • i wrote my own tooltip, but it wont show, and even dont call the paint methodin my component, i override the createtooltip method like thispublic JToolTip createToolTip(){TestToolTip tip = new TestToolTip();tip.setComponent(this);return tip;}and i wrote 2 classses//TestToolTip.javapublic class ...
  • customer gui components needed?
  • I require to build a program with which allows the user to add representations of objects onto the main GUI by adding a seperate square for each object. each square should be capable of being moved, resized, deleted as well as have text displayed in it, and another object associated with it ...
  • Customed Menu
  • Hi everybody.First of all, excuse my english, i'm italian and i'm sure i'll make a lot of mistakes ;)And please excuse me if the question i'm going to ask has already been discussed, i tried to find it but the forum is TOO big ;)I'm developing a little application that has to run on ...
  • Customed JLabel & Customed JButton
  • Hi, Simple question: - If I do a customed JLabel or JButton, upon clicking...can it fireup a JDialog?PS: I'm fairly new in Swing.--Thank you.- Simon Seesimon-ivy.thatisjava.com.usa.net-after office hours-necro-mani-cide...
  • Post a Comment Now.
  • Comments
  • Thu, 12 Jul 2007 08:41:00 GMT(1)
  • Did you check BasicMenuItemUI class, create you own ui, and overwrite its "paintMenuItem" method, i guess this will solve your problem.
  • Thu, 12 Jul 2007 08:41:00 GMT(2)
  • Thanx, I'll check that right now !
  • Post a Comment Now.
  • Maybe you're interest in these...
  • Access application on different port
  • [Web Tier APIs] HII have webapplication which i deploy on my local machine in Tomcat server which is runnig on Port 8080.i use following url to load run it "http://localhost:8080/myApp/index.html".i want that another part of myapplication which is on same server and i want to access it with differenet port and ......
  • help with outputting arraylist to textfield...
  • [Java Miscellaneous] Hi, sorry to take up your time with my small problems but i am really tearing my hair out with this.The problem is I have an arraylist called 'names' and all i want to do is get all the names from the list into a textfield. This is what i have so far to give you an example. public String ......
  • Component is visible only when frame is resize why?
  • [Java Core GUI APIs] hai,In My application the components are visible only when the JFrameisresize...... why is it so?The problem is in login screen.. that is the frame is displayed in middle the default layer for this borderlayout.... the panel here consists of gridbaglayout whats the problem?the size are all i ......
  • Exception when running JSP on Tomcat!Pls help me!
  • [Enterprise Technologies] HTTP Status 500 - --type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: /JspTestBean3.jsp(3,4) Invalid directiveat ......
  • JSP & ASP interaction
  • [Web Tier APIs] JSP page do a form post to the ASP page with the variables you wish to transfer. If you're sending a complex piece of data, just post one hidden field (<input type="hidden" ...) and set the value of the field to be an XML string. Any Example for this ?>......
  • Properties file
  • [Java Intermediate] Is there any specific switch to pass a Properties file from the command line?......
  • [FFJ-EAP] Gray square artifacts caused by mouse cursor Win2000
  • [Sun ONE Studio] I had your problem. My solution: upgrade video drivers (Matrox G450 here).-- ~To unsubscribe from this mailing list, please visit http://forte.sun.com/eap/lists.htmlIf you have any problems, please contact listmaster.thatisjava.com.forte.sun.com ......
  • Direct access of data members without Mapping file?
  • [Java Open Source Software] From the documentation I have noted that a Mapping file can used toconfigure Castor to directly access public class variables (i.e. setting the<field> element's "direct" attribute to true). I am working with someclasses that have public data members and would like to use Castor forunm......
  • Localisation errors
  • [Java Products] Hi,I am trying to run an application to implemet localisation.SpringappController.java is :package com.cybertech;import org.springframework.web.servlet.mvc.Controller;import org.springframework.web.servlet.ModelAndView;import javax.servlet.ServletException;import javax.servlet.http.HttpServletRe......
  • [JIRA] Created: (DSY-310) Under Windows: generated
  • [Java Open Source Software] Under Windows: generated runc2.bat sets the JAVA_OPTIONS variable wrong----Key: DSY-310URL: http://issues.cocoondev.org//browse/DSY-310Project: DaisyType: BugComponents: Frontend (wiki)Versions: public - 1.5Environment: Windows XP, JDK 1.4Reporter: Yves LangischPriority: MinorThe variables mustn......
  • Java Technology Blogs
  • "Swing / AWT / SWT / JFace" Related Questions
  • Custom tree node & DefaultTreeModel
  • Hello,I would like to know if it's possible to use the following custom tree node with the DefaultTreeModel:class MyTreeNode extends DefaultMutableTreeNode{ private String _argument = null; public MyTreeNode(){} public MyTreeNode(Object node, String argument){super(node);_argument = argument;} ...
  • Custom Titlebar
  • I am trying to get a JFrame titlebar to show characters such as subscript - with no luck so far. I have tried both html and unicode. If I make the frame undecorated, it shows up, but otherwise looks terrible.It seems that I will need to do some customization, but I'm not sure where to ...
  • Custom TextFields ... anyone?
  • Hi,I need to create a Custom textfield - ie. a Time Field that accepts a time value of the form "24:59:59".Firstly I need to have some kind of a mask that allows me to show the **:**:** colon characters.I also need to validate the number characters so that the first number cannot be greater ...
  • custom textfield not working
  • Hello,I tried to create a custom textfield and its not working properly. Please see my code and help me how to improve it.Thanks// class MyTF.javaimport javax.swing.*;public class MyTF extends JTextField{JTextField jtf;static String str;public MyTF(){jtf = new ...
  • Custom text painting using JTextField
  • Greetings all!I would like to implement a custom JTextField that displays text in gradient colors instead of the usual solid colors.I guess I would need to override the default painting mechanism in JTextField, but I'm not sure how to go about it. Would appreciate if anyone can give me any ...
  • Custom Tags in JTexdtPane
  • Hi!I have a problem: I have to write some kind of editor but with own defined tags. So when the text is marked with some styles (bold, etc) I must wrap the part with the special style with a own defined tag. i.e. <myOwnTagStyleName>.....</myOwnTagStyleName>I found nothing about this ...
  • Custom TableModel not firing Events
  • I have a custom table model with a Table Model Listener. The Listener used to work (before I creted my own Model) but now it seems that the event is never firing. I'm not sure what method I have to override or overload to achive this. I was looking at the source of AbstractTableModel, I even ...
  • Custom TableModel -Dynamic Headings
  • Is it possible to read column names from a database and use them when creating the columnNames[] array? I have tried this and I get this error:C:\al\pool\MyTableModel.java:16: variable columnNames might not have been initializedpublic MyTableModel(String sql) {The arrow points to '{'.I check ...
  • Custom Tablemodel abd renderer.
  • Hello!Here is my problem.I have a Jtable that use a custom model to hold datas ('Ability' class instances).The method getValueAt return an 'Ability' class instance depending on the row.Problem is that I implemented a custom renderermytable.setDefaultRenderer( Ability.class, new ...
  • Custom TableCellEditor/JTable feel
  • OK, I think what I have to do is to make my own TableCellEditor but I'm not sure on exactly what it is i have to to.This is what I want:A table so that when you have a cell selected, and you start typing, then the text in the cell disappears to be replaced with your text that you are typing. ...
  • Custom TableCellEditor focus / first keystroke problem
  • Hi.I needed an editor that has a text field, with a button next to it to validate, & display status of, the entry.So, I''ve created a class that implements TableCellEditor.It contains a panel, which in turn contains a DefaultTableCellEditor and a JButton.(Methods required by the ...
  • Custom table model, table sorter, & cell renderer to use hidden columns
  • Hello,I'm having a hard time figuring out the best way to go about this. I currently have a JTable with an custom table model to make the cells immutable. Furthermore, I have a "hidden" column in the table model so that I can access the items selected from a database by their recid, and then ...
  • Custom Table Model from Default Table Model
  • I'm creating a customised table model to create a table with column header and empty rows.But it is throwing Component paint_imediatly error.If i pass in empty string to the row vector then setNumRows then no problem. If i do like this later it throws me error in my addNewRow method which was ...
  • Custom Table Cell Renderer Unable To Set Horizontal Alignment
  • Hello,I have a problem that I'm at my wit's end with, and I was hoping for some help.I need to render the cells in my table differently (alignment, colors, etc) depending on the row AND the column, not just the column. I've got this working just fine, except for changing the cell's ...
  • Custom Swing Components
  • Hi All,Im New to Swing, and for the last few days im exploring Swing components.I noticed that in almost every Swing application I saw, the Swing components are not looking the way the original components looks in the Swing Jar.my question is where can I find custom swing components libraries, ...
  • Custom shape of JButton ...
  • Hii am trying to change the geometry (from rectangle to other) of a JButton by redefining the BasicButtonUI to draw the new shape as follows:public class TestButtonUI extends BasicButtonUI{...public void paint(jGraphics g, JComponent c){AbstractButton b = (AbtractButton)c;// Paint BODY of ...