Drawing new components

Here's a question that's plaguing me.
What should I do if I wanted to draw a component(either applet or Swing and maybe both) differently from what it used to be?
For example, I want my button not to be rectangular but circular(doesn't have a rectangular border of course!)
Do I override some method? Which is it?

here's a good example: http://java.sun.com/products/jfc/tsc/articles/swing2d/index.html

Similar Messages

  • Drawing New Components too Late?

    Hello everyone,
    I have a snippet of code here involving a 'please wait' sheet. Similar to a loading screen i would imagine.
    if (player.getComponent() != null)
       JFileChooser fc = new JFIleChooser();
       int FCVal = fc.showSaveDialog(this);
       if (FCVal == JFileChooser.APPROVE_OPTION)
          su.showSheet();
          player.produceJPEGSnapShot();
          su.hideSheet();
    }The problem lies in the su.showSheet(); Where the method draws a 'sheet' frame onto the main UI frame, as a JInternalFrame. It does do it, however it seems to 'wait' to draw it until this current thread is free. And thus not actually showing anything. I have tried wrapping a new thread around this as well, same result.
    produceJPEGSnapShot() is a method that takes a good 2-3 seconds to complete.
    Anyone know any other way to do this?

    You'll likely need to use a background non-EDT thread to do your busy work. Something like so:
        if (player.getComponent() != null)
           JFileChooser fc = new JFileChooser();
           int FCVal = fc.showSaveDialog(this);
           if (FCVal == JFileChooser.APPROVE_OPTION)
              su.showSheet();
              // the background thread starts here
              new Thread(new Runnable()
                public void run()
                  player.produceJPEGSnapShot(); // do this off of the EDT
                  SwingUtilities.invokeLater(new Runnable()
                    public void run()
                      su.hideSheet();  // do this on the EDT but only *after* player finishes his thing
              }).start();
        }Edited by: Encephalopathic on Jun 12, 2008 2:04 PM

  • Cannot add new components in Object Browser

    Hi,
    We have a complex file with about 80 components. The problem is that when I try to add new components, they're not visible in Object Browser. It's possible to drag components into canvas, but not only they don't appear in object browser but also vanish after saving and re-opening the file.
    No error messages or hang-ups. It's just as if adding become disabled or something.
    I'll appreciate nay help on this

    Is the new component hidden in the grouped objects, can you see it in the Objects browser?
    You can drag a component out of a grouped object from within the object browser.  Select the component and drag it up onto the grouped component name, it should then be outside of the grouping.
    What version of Xcelsius are you using?
    Regards
    [Charles|http://www.reportex.co.uk/xc_waterfallchart.html]

  • How do I properly setup pin and gate swap groups on new components​?

    Hi,
    I've looked for some documentation explaining exactly how the pin and gate swap functionality works but I have not been successful.
    I am trying to get pin and gate swapping working correctly on some digital logic components that I have created (side question - why no modern 74 series logic components like LVC?) as well as RPACKS and some connectors.
    Is it a requirement to create a multi-section symbol to enable gate swapping?  I can't seem to get it to work unless the symbol has multiple sections.  It doesn't work by default for the RPACKs included in Multisim.  If it's possible to do gate swapping by putting the pins of each gate in their own gate swap group I would really like to understand what I'm doing wrong.
    In the Component Properties 'Footprint' tab you can define the 'Pin swap group' and 'Gate swap group' settings.  I have not seen any documentation explaining this and frankly, I'm quite confused by it when using existing 74 series parts as examples.  The single section symbols don't have any pin swap or gate swap groups defined and the multisection symbols have only one gate swap group and then put all inputs in one pin swap group and all outputs in another pin swap group.
    I would really appreciate it if someone could point me to documentation that explains how to do this.  The help files are quite poor in my opinion - they seem to only be able to point out the obvious.  The 'Getting Started,' 'Fundamentals,' etc. type guides don't mention this stuff at all.  The 'User Guide/Manual' (both of which appear to be outdated?) do not explain this and frankly don't have very much information about pin and gate swapping at all.
    I'm hoping I'm just missing something obvious.
    On a related note - I'm having some trouble working with some of these multisection components.  When I want to change the footprint or update the component after making a change to the component in the database I can't seem to find a quick way to do this.  It seems that I always have to go through a drawn out process of 'Replacing' each individual symbol section.  Is there a faster way to do this?
    Thanks,
    Kleven

    Hi Pat,
    I'm working with some SAMTEC connectors.  I don't expect you guys to have these built by default in the library - they are somewhat custom.  But just so you can consider it, we are using the TFM and T2M family of connectors and I'm adding them as additional footprints for the standard dual row headers.  I'm having some trouble with the footprint for the TFM screw-down option since it is a very odd footprint, but I'm going to start a seperate thread discussion for that since I really just need to understand how to manipulate Ultiboard to get the desired result and it's really a different discussion.
    As for RPACKs, I'm a little confused about how Multisim currently supports these. The Value tab in the properties dialog only lets you set the resistance.  Why isn't this more like the resistor value tab?  Since the Value tab is modified like a virtual component it's disappointing that it doesn't offer more capability like the other virtual passives.  In my limited experience I've seen the isolated-4 resistor pack used the most, but like I said, that is limited experience.  It would be nice if some surface mount footprints were added to the master database for RPACKs in the future.  4x0402, 4x0603, and 4x0805, concave and convex, seem like pretty common footprints as best I can tell.
    Virtual components work great in a purely physical design because you can easily change the footprint in the 'Value' property tab.  With the provided RPACKs and LEDs you can't do that, so I had to create new components in the User/Corporate database.  Of course, the LED can't be copied so I had to create it from scratch.  But the RPACK could be copied even though it had a modified Value tab, implying it is a virtual component, if I understand correctly.  Maybe these distinctions and limitations are well defined but I found it somewhat confusing that there were several common parts I had to either copy and modify or build from scratch.
    Since I created those parts, we updated to the PowerPro version and though I'm not certain, I think I can change the footprint in the spreadsheet view.  But in the standard version, I didn't see a way to change the footprint without replacing the component.
    Also, it seems like changing the footprint does not behave quite like I would expect.  If I have a database part which has multiple footprints mapped already, I would expect to be able to choose between those footprints already supported by the database part when I try to change the footprint using the Properties->Value tab or the spreadsheet view.  If I need to change to a footprint that currently is not associated with the component in the database, I would expect to have to edit the database part, add the footprint, map the pins, re-save the component, then update the component in the schematic.
    Is my thought process making too many assumptions here?  I understand that I am one person creating one design in one specific way.  So I'm sure I'm missing some usage cases or intended uses of the tool, especially since I haven't taken any training for this software and have tried to teach myself how to use it over the last 9 months.  And I have noticed that even for virtual resistors and capacitors, the footprint selection dialog is the same - a selection from the database and setting up a new pin mapping.
    As for 74 series parts, seeing the LVC family would be very nice.  This is 3.3V-2.5V and seems like the next logical step for lower voltage support.  It would also be nice to see some surface mount footprints with the 74 series parts.  This isn't a big deal though - it didn't take me long to create the parts I needed by copying and editing from the Master database.  And since I'm not using the simulation models, that made it even easier.  Since I haven't looked into the models at all, I don't know if that would have taken longer to convert to the LVC family.
    I've probably rambled enough for now.
    Thanks!
    Kleven

  • Add a new Components into SAP

    Needs to Add a new Components into SAP. Is any SAP tool is available to do the same.....

    Hi,
    For add-on's you can use transaction SAINT.
    I am sure this has been answered many times before.
    Regards,
    Vishnu.

  • Flex builder 3 don't show new components

    Hi,
    I've installed flex builder 3 beta 3. The new components such
    as the advanced datagrid don't show in the components window.
    Actually they were showing but for some reasons they are gone now.
    I also have flex builder 2 installed on the same pc, but it
    shouldn't be an issue.
    I've made sure in the preferences that flex builder 3 uses
    the right sdk (3.0 beta 3)
    Can someone help ?
    Thanks

    Yes I was definitely running 3.0. I've solved the problem by
    reinstalling flex 3.
    However sometimes I get a nasty crash when I open a component
    in Design mode and when the Properties window of this component is
    opened. Then Flex closes and I get a popup with error log. Will
    post it next time I see it.
    Overall it seems ok though, I'm already enjoying the advanced
    datagrid :)

  • After a few minutes on certain websites, firefox stops drawing new frames without a mouse movement to force a redraw

    After having certain pages open for between 5-15 minutes (at the most) such as youtube, facebook, or myspace (these are the sites that consistently cause it, but are not limited to them.) The browser no longer draws new frames without the mouse being moved and calling the draw function through it.
    The issue started a month or two ago. There had been no new plugins or add-ons installed for at least another month prior.
    The closing X in the top right also becomes non responsive (though it will light up.) The browser can be closed through the right click menu in the task bar, along with the closing X in the thumbnail preview.
    Program and window completely freeze when attempting to move the window for around 10 seconds, then move to the location designated.
    Other browser have no issues.
    system: Windows 7 Ultimate 64 bit.
    6GB RAM 1600Mhz
    core i7 920
    1.5TB free space in C drive
    currently installed plug-ins are:
    Acrobat 9.3.0.148
    Java Deployment Toolkit 6.0.210.7
    Java Platform SE 6 U21 6.0.210.7
    Mozilla Default Plug-in 1.0.0.15 (disabled)
    Shockwave Flash 10.0.45.2
    Shockwave for Director 11.5.7.609
    Silverlight 3.0.50106.0
    Unity Player 2.6.1.31.223 (disabled)
    Windows Live Photo Gallery 14.0.8081.709 (disabled)
    Yahoo Application State Plugin 1.0.0.7 (disabled)
    Extensions:
    AVG Safe Search 9.0.0.855
    AVG Security Toolbar 4.002.023.004
    Java Console 6.0.18 (disabled)
    Java Console 6.0.21
    StumbleUpon 3.73
    XULRunner 1.9.1 (disabled)
    Zynga Toolbar 2.7.1.3 (disabled)
    Only default Theme installed.

    Podcast (original): http://council.cio.com/podcast/temp.mp3
    Podcast (re-encoded by iTunes): http://council.cio.com/podcast/temp3.mp3
    Music MP3s that aren't working for me:
    http://council.cio.com/podcast/findyouregone.mp3
    http://council.cio.com/podcast/findyourehere.mp3
    http://council.cio.com/podcast/youvideoversion.mp3
    Music MP3 that is working:
    http://council.cio.com/podcast/twoareone.mp3
    (Oh, and ignore my comment earlier that this mp3 stopped working. I got confused back there with all the various tests... This file does play fully. The player also waits until the file is fully downloaded before starting to play... As opposed to the others where the player starts and ends playing before they are downloaded completely.)

  • New Components creation in Java Studio Creator

    Is it possible to develop new components in this IDE? I didn't found any support for it.
    With Regards
    Areg

    Hi,
    I presume you are talking about creating JSF components in Creator. As of now this feature is not available but it is on the cards for future releases.
    Cheers :-)

  • ADF Faces - New components

    Hi,
    Oracle corporations has plans to incorporate new components?
    If answer is if, As and when?
    Thanks.

    Hi! Frank,
    If new Components will be added to Trinidad, then will we, the Oracle ADF faces users, be left untouched by the additions?
    if so , should we migrate to OpenSource ADF Faces/Trinidad ?
    Or will the Components addded to Trinidad , will also reflect in Oracle ADF Faces version.
    I request you to Please Clarify this,
    Thanking you,
    Samba.

  • Decision to prefix the new components as  Fx   is final?

    Is the decision to prefix the new components with Fx-  final?<br /><br />It's really a show stopper for me.<br /><br />I understand that there are technical reasons for this move, but when I think about the matter I cannot but ponder that we must not forget that Flex is up for a tough battle against SilverLight for the developers hearts & minds , and it definitely feels much more natural to developers to think in terms of a < Button > and a < List > than to work with prefixed classes.<br /><br />It also saddens me to think that so many developers coming to Flex for the first time in 2010 and beyond will be forced to write annoying <FxThis>  <FxThat> all the time for the sole reason that "back in 2008" there was something called Halo components, which they will never even happen to use.

    "... though if there was a major uproar in the community [...] we'd certainly be open to it. "
    Major uproar delivered!
    Thanks for listening ;-)

  • Enabling new components -- sneak peek

    This posting has information aimed at third party developers, but end-users may be marginally interested in this too. One of the planned new features for an upcoming release is improving support for new components. I just wrote a blog entry on this. For more info, see http://blogs.sun.com/roller/page/edwingo/20041210#enabling_custom_jsf_components_in.
    Happy coding!
    -Edwin

    cool, can't wait any idea when the next patch is
    going to be out?I believe the current subscription model is to release every quarter so I would guess definitely by the end of January -- maybe sooner. However, please note that this feature only enables third parties to provide libraries and it doesn't provide the component libraries themselves.
    -Edwin

  • Installing new components....

    Hello everyone....
    I've recently started a project with a computer that I acquired. It's a Powermac G4 Quicksilver 800 mhz single processor. It has no video card, no ram, no hard drive, and a CD/RW drive installed.
    The question I really have is which new components to put in first? I have an ATI Radeon 9200 AGP card flashed for Mac use. But without a base card to work from, how do I go about installing the drivers and updates as instructed by the vendor? Do I need to put in the hard drive, the ram (which I have from another computer), the video card, and just boot from my Tiger install via firewire? I have the replacement DVD/RW drive, but do I need to get OS X on there first? OR do I need to put in all the components, turn the thing on and hope for the best?
    Kind of a weird question, I realize, but I just wondered if anyone has any thoughts?
    Let me know if I can provide any more information.
    Thanks.
    Sammy

    Hi, Sam!
    You might give us some specifics about the other components you have that you are about to install (ie: brand, model, RAM type, etc)? I don't mean to hassle you, but just want to insure the components' potential compatibility . If you're already certain that the hardware should be compatible, then put it all in there, test the battery to insure it reads 3.3volts or more, reset the PMU, attempt to boot to a retail version of the Tiger install disk, and cross your fingers. (The hard drive should be jumpered as Master and connected to the end connector of the ribbon cable. Same goes for the optical drive.
    I say put it all in, because you can't properly install OS X without a hard drive, video card and RAM installed, so you may as well put the optical drive in at the same time. If you install OS X without the optical drive, then for starters, the DVD Player application won't be installed, causing you to have to address this afterwards.
    Your question is not weird at all, but instead rather thoughtful, IMO...
    Gary

  • MouseListener on new Components

    I made a MouseListener on a component, while my mousebotton were pressed. I then moved my mouse over the new component, and released the mousebotton. Now i expected a mouseReleased Event, but nothing happend. Now my questing is:
    Is it not possible to listen on new Components before i release my mousebotton? And if it is... how???
    Thanks in advance...
    Kenneth Vindum

    Dosn't matter... Changed the code, and made it work that way...

  • Advanced drawing of components

    Hey all,
    I have yet to see a really good book that explains in detail the various capabilities of the Graphics 2D. There are tons of capabilities, like Shape and all its subclasses, Transform, the many methods of Graphics2D, and so on. There are some VERY kick-ass possibilities yet it seems very few people understand how to use these more advanced features of Graphics2D.
    As an example, I am trying to create a nice rounded, shadowed panel component with a gradient shadow and definable rounded corners with a definable arc. For the most part, it hasn't been difficult doing the rounded stuff, but trying to get the shadow just right, faded on the rounded curve, and so on has not been easy. I have tried many things, from using fillRoundRect, to fillArc, to looking at using clipping and compositing, possibly a Shape object, etc. I am no graphics expert, so the lack of docs/tutorials that explain how to really use the Graphics2D and all of its capabilities is disappointing. I almost feel I need to be a 2D/3D expert to understand the various features.
    So, does anyone have any good links, or book suggestions that really explain Graphics2D and really delve into advanced drawing features, such as creating custom drawn components? Are there some free resources on the net to help out? If not, I will be happy to buy a good book or two.
    I want to learn how to use Shape, Compositing, clipping, gradients, transforms, text and fonts, strokes, and so forth in good detail, enough that I can answer a good deal of questions posted in this forum and others and know how to attack a problem like a rounded shaded cornered panel component.
    Speaking of, one concern I have with making a rounded panel is how to enforce that components added to the panel are within the inside rounded edges. Is this the job of insets()? I thought of using an internal panel and delegating all the add(), find(), get(), remove() and other methods of the JPanel that I extend (or JComponent), to the internal panel. I have also tried drawing the shadowed portion as a border, so that perhaps (hopefully) I dont need an internal panel component, as that seems a bit messy. But I surely don't want any components to be added that overlap the rounded edges. Any ideas on this?
    Thanks

    I have been thinking about using it as a border
    instead of drawing it as a complete component. I think
    that would allow the internal components to be added
    to the panel without much fanfare of the rounded
    border, although it may still pose a problem should
    the rounded edges and shadow take up more space than
    they should. I don't know much about insets, but I am
    hoping by adjust the insets that the add() methods
    would use those to place components within the inset
    range and not the entier 0,0,width,height of the panel
    itself.That's the job of the layout manager -- if it is stretching components to fill a panel, it should
    know about the (left, top, bottom, right) gaps of the insets as dictated by the border and place
    components not within rectangle (0, 0, width, height) but within rectangle
    (left, top, width-left-right, height-top-bottom).
    That being said, I wish I had a nickel for every time I read someone's custom component method,
    where their paintComponent assumes that can draw at (0,0) -- no realizing they have to offset for the
    insets of the border!
    A demo that shows GridLayout knows about borders:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class ExampleBorder implements Border {
        private int thickness;
        private Color color;
        ExampleBorder(int thickness, Color color) {
            this.thickness = thickness;
            this.color = color;
        public Insets getBorderInsets(Component c) {
            return new Insets(thickness, thickness, 0, 0);
        public boolean isBorderOpaque() {
            return false;
        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            Color oldColor = g.getColor();
            g.setColor(color);
            if (width > thickness)
                g.fillRect(x, y, width-thickness, thickness);
            if (height > thickness)
                g.fillRect(x, y, thickness, height-thickness);
            g.setColor(oldColor);
        //convenience
        public JComponent wrap(JComponent comp) {
            Border old = comp.getBorder();
            if (old == null)
                comp.setBorder(this);
            else
                comp.setBorder(BorderFactory.createCompoundBorder(this, old));
            return comp;
        //sample main
        public static void main(String[] args) {
            ExampleBorder panelB = new ExampleBorder(6, Color.BLUE);
            ExampleBorder compB = new ExampleBorder(2, Color.RED);
            JPanel cp = new JPanel(new GridLayout(2, 2, 1, 1));
            //cp.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            panelB.wrap(cp);
            cp.add(compB.wrap(new JButton("alpha")));
            cp.add(compB.wrap(new JButton("beta")));
            cp.add(compB.wrap(new JButton("gamma")));
            cp.add(compB.wrap(new JButton("delta")));
            JFrame f = new JFrame("X");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(cp);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);

  • New components not being included in automatic builds

    Is it my imagination, or did something change between FB3
    Beta 3 and Final that causes new Flex components to be excluded
    from project builds until they are referenced by other classes
    currently in the project?
    The specific pain I'm experiencing is that I don't get syntax
    errors or warnings reported when editing freshly added components
    and saving the file.

    I can't speak definitively, but have heard this complaint
    before. I'm still on Beta 3
    Tracy

Maybe you are looking for