How to design an always square Jbutton?

The JButton without any label or image is always square, and could be resized by its container or layout. But no matter how it is resized, it could only be square.
Could anyone help me on that?
Edited by: bbskill on Feb 18, 2008 4:19 AM
Edited by: bbskill on Feb 18, 2008 4:20 AM

Well, your questions doesn't really make a lot of sense. When you use a layout manager, then the rules of the layout manager may change the shape of the button as the frame is resized. This depends on the layout manager you are using. So we can't really help you because we don't have all the information.
If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
http://homepage1.nifty.com/algafield/sscce.html
Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
http://forum.java.sun.com/help.jspa?sec=formatting

Similar Messages

  • From a Technical Architect point of view, how to design a web application?

    Hi to all,
    I am writing this issue here because I this question is not related on how to program, but on how to design a web application. That is, this question is not related to how to program with the technologies in J2EE, but how to use them correctly to achieve a desired outcome.
    Basically I know how to develop a simple web application. I like to use SpringFramework with AcegiSecurity and Hibernate Framework to persist my data. I usually use JBoss to deploy my web applications, however I could easily use Tomcat or Jetty (Since I am not using EJB�s).
    However I have no idea on how to develop (or a better word would be �design�) a website which is divided into different modules.
    Usually when you develop a website, you have certain areas that are public, and other areas that are not. For example, a company would want anyone on the Internet to download information about the products they are selling, however they would only want their employees to download certain restricted information.
    Personally I try to categorise this scenario in to common words; Extranet and Intranet.
    But � (and here starts the confusion in my mind) should I treat these two as two projects, or as one project? The content to be displayed on the Extranet is much different then the content to be displayed on the Intranet and definitely clients should not be allowed to the Intranet.
    First approach would be to treat them as the same project. This would be perfect, since if the company (one day) decides to change the layout of the website, then the design would change for both the Intranet and the Extranet version. Also the system has a common login screen, that is I would only need to have employees to have a certain Role so that they have access to the intranet, while clients would not have a certain Role and thus they would not be allowed in. But what about performance and scalability? What if the Intranet and Extranet have to be deployed on the different Hardware!?
    The second approach is to threat them as two separate projects. To keep the same layout you just copy & paste the layout from one project to another. However we would not want to have two different databases to store our users, one for the employees and the other one for the clients. Therefore we would build a CAS server for authentication purposes. Both the Intranet and the Extranet would use the same CAS server to login however they could be deployed on different hardware. However what if we want to change the design. Do we really want to have to just copy and paste elements from one project to another? We all know how these things finish! �We do not have time for that � just change the Extranet and leave the Intranet as it is!�
    The third approach (and this is the one I like most) is to have a single project built into different WAR files. The common elements would be placed in all WAR files. However in development you would only need to change once and the effects would show in the different war files. The problem with this approach is that the project will be very big. Also, you will still need to define configuration files for each one of them (2 Web.config, 2 Spring-Servlet.config, 2 acegi-security.config, etc).
    Basically I would like something in the middle of approach 2 and approach 3! However I can identify what this approach is. Also I can not understand if there is even a better approach then these three! I always keep in mind that there can always be more then two modules (that is not only Intranet and Extranet).
    Anyways, it is already too long this post. Any comments are more then welcome and appreciated.
    Thanks & Regards,
    Sim085

    Hi to all,
    First of all thanks for the interest shown and for the replies. I do know what MVC or Multi-layered design is and I develop all my websites in that way.
    Basically I have read a lot of books about Domain-Driven Design. I divide my web applications into 4 layers. The first layer is the presentation layer. Then I have the Facade layer and after that I have a Service layer (Sometimes I join these two together if the web application is small enough). Finally I have the Data Access layer where lately I use Hibernate to persist my object in the database.
    I do not have problems to understand how layering a web application works and why it is required. My problem is how to design and develop web applications with different concerns that use same resources. Let me give an example:
    Imagine a Supermarket. The owner of the Supermarket want to sell products from the website, however he wants to also be able to insert new products from the website itself. This means that we have two different websites that make use of the same resources.
    The first website is for the Supermarket clients. The clients can create an account. Then they can view products and order them. From the above description we can see that in our domain model we will have definitely an object Account and an object Product (I am not mentioning all of them). In the Data Access layer we will have repository objects that will be used to persist the Account and Products.
    The second website is for the Supermarket employees. The employees still need to have an account. Also there is still a product object. This means that Account and Product objects are common to the two websites.
    Also important to mention is the style (CSS). The Supermarket owner would like to have the same style for both websites.
    Now I would not like to just copy & paste the objects and elements that are common to both websites into the two different projects since this would mean that I have to always repeat the changes I make in one website, inside the other one.
    Having a single WAR file with both websites is not an option either because I would not like to have to deploy both websites on the same server because of performance and scalability issues.
    Basically so far I have tought of putting the common elements in a Jar File which would be found on the two different servers. However I am not sure if this is the best approach.
    As you can see my problem is not about layering. I know what layering is and agree with both of you on its importance.
    My question is: What is the best approach to have the same resources available for different websites? This includes Class Files, CSS Files, JavaScript Files, etc.
    Thanks & Regards,
    Sim085

  • How to make new line in JButton.setText()?

    how to make new line in JButton.setText()?
    I want to set the text of jbutton in tow line ,as follows
    | jbutton-line1 |
    | xxxxxxx-line2 |
    i konw i can jbtton.settext("<html>line1<br>line2</html>");
    but i find it's ugly using html,
    is there anyother way to create new line in JButton's Text

    As for the above comment....
    I thought the question was well purposed. Using HTML was not acceptable in this instance, which was made clear, so why critisize his comments? "Using HTML" is a poor solution, it does NOT work in many instances due to browser, OS variations. Usually the "common answer" is never a COMPLETE answer.
    Possible Solution:
    Use JLabels to render the text on the button.
    import javax.swing.*;
    import java.awt.*;
    public class ButtonMaker {
    public static void makeButton(JButton jb, String[] titleList) {
    jb.setLayout(new FlowLayout());
    for (int i = 0; i < titleList.length; i++) {
    JLabel tmpLabel = new JLabel(titleList);
    tmpLabel.setForeground(Color.black);
    jb.add(tmpLabel);
    public static void clearButton(JButton jb) {
    Component[] cList = jb.getComponents();
    for (int i = 0; i < cList.length; i++) {
    if (cList[i] instanceof JLabel)
    jb.remove(cList[i]);
    Known Limitations:
    1. Flowlayout does not work well with single line text buttons... perhaps another layout manager may work better for various buttonsizes-linenumber combos.
    2. Mac OSX : The default UI for Mac OS X (and above it seems), is to have rounded edged buttons. These rounded edges are destoryed when using JLabels, leaving a square, blocky button in its place.
    POSSIBLE SOLUTION:
    (this is ugly and time consuming)
    - create images of the button with text on them.

  • How to design EDW for source systems from different Time-Zones

    How to design EDW for source systems from different Time-Zones?
    Suppose IT landscape has a global BW in New York, and source systems in americas, europe and asia, then how the time-zones effect on time related things like delta selections on date or timestamp etc.

    As you said BW is global in NY, your source system must be global too. People from various locations can connect to same source system and thus timestamps for delta is always maintained as 1 single time. We have same scenario in our project. Our R/3 system is used by users in US and Europe. So we run deltas twice in day to make sure we got deltas from both locations.
    If scenarios was such that all locations connect to separate R/3 system, then obviously you have multiple queues. That is unique delta queue for each source system so deltas will be pulled as per data in respective queues.
    Abhijit

  • How to design a GUI Python app properly?

    Hi guys. As motivation to actually learn Python, I want to carry out a fairly simple application that's been brewing in my head for months; a "game manager" that a gamer can use to keep track of the games he owns, the games he's beaten, and any specific challenges he's completed in said games.
    The problem is that I can't seem to wrap my head around Python. I look through its docs to solve problems but I almost always end up lost. I come from PHP, which is supposedly sloppy, but it's also very easy to get almost anything done quickly. In my frustration, I proved that I could get more progress in 15 minutes in PHP than I had gotten in 2 hours in Python. I was right, but I know that PHP isn't the right tool for the job. I want to make an actual desktop application that relies on an sqlite db.
    With my frivolous backstory out of the way, could anyone offer any enlightenment on Python? I've tried the tutorials, I've tried the docs... where can I go to learn not only how to code my app, but how to design it? Design is more important than syntax, imo, because it relies on concepts which form the foundation of whatever app you're building.
    I can post an overview of how I want the app to behave, if that would help others advise me on how to build it in Python. I'd really like to pick the language up, but it's being anything but "easy to learn".

    Are you sure you've read the helpful tutorial? If you can't grasp it, perhaps PHP has finally penetrated the shell of coding sense surrounding your brain and started eating. (I used to be close to that point. Now I believe Python is god.)
    Oh, and never start with something as big as a full-blown graphical application. Trust me, it is never as simple as it first seems when you conceive the idea. Start with small, one-file utilities and work your way up from there. Consider downloading the full documentation so you always have a local copy.
    And remember: If your code seems ugly, it probably is. There is almost always a better way in Python.
    Last edited by Peasantoid (2010-02-06 05:14:43)

  • How to design a program on paper.

    how to design a program on paper.
    I am planning to create a small program, I want to do some paper work before writing the first line of code, what do I do and how do I do ?
    should I learn UML and do it or any other thing ?
    my question is to experience programmers, what do you do before writing the code for any program ?

    Most projects do very little other than collect information, process the information, and store the information.
    1st - Identify what your project really is (project statement including well defined scope)
    2nd - Identify resources
    Data
    Users
    Equipment Needed
    Developers available for the project
    etc...
    3rd - Do a reality check against your resources
    4th - Aquire more resources as required or scale back project scope
    5th - Get buy off from interested parites on your project definition and scope.
    6th - loop back to 1 as need to attain a working definition and resources to complete the project.
    (Notice: no code has been written yet--nor even thought about)
    7th - Identify Data and Data Sources
    8th - Define appropriate distribution of functionality across Tiers
    9th - Assign teams for each or set phase of each for implementation purposes (according to project needs) Note: User Interfaces are always most complex -- assign your people accordingly.
    10th - Identify data and processes specific to tier
    11th - process flow models with data flow over lays
    12th - design objects to implement process and facilitate data flow
    13th - functionality review and buy off from clients
    14th - loop back to 10 as needed
    (Notice: no code yet)
    15th - <here it is> code here
    16th - debug (with code reviews)
    17th - integrate
    18th - debug (with code revies)
    19th - loop back to 15 as needed
    20th - alpha test (large integration)
    21st - debug (with code reviews)
    22nd - loop back to 20 as needed
    23rd - beta and user trials
    24th - user requested changes
    25th - debug (with code reviews)
    26th - loop back to 23 as needed
    27th - user buy off
    28th - project delivered
    29th - wrap up and archive of documentation
    30th - on going (life cycle) maintenance.
    There ya go, that is about what I go through when desiging a project--the coding is a very very small part in comparison to the rest. Coding come to approximately 20% of a project.

  • How to design SQL server data file and log file growth

    how to design SQL DB data file and log file growth- SQL server 2012
    if my data file is having 10 GB sizze and log file is having 5 GB size
    what should be the size in MB (not in %) of autogrowth. based on what we have to determine the ideal size of file auto growth.

    It's very difficult to give a definitive answer on this. Best principal is to size your database correctly in advance so that you never have to autogrow, of course in reality that isn't always practical.
    The setting you use is really dictated by the expected growth in your files. Given that the size is relatively small why not set it to 1gb on the datafile(s) and 512mb on the log file? The important thing is to monitor it on an on-going basis to see if that's
    the appropriate amount.
    One thing you should do is enable instant file initialization by granting the service account Perform Volume Maintenance tasks in group policy. This will allow the data files to grow quickly when required, details here:
    https://technet.microsoft.com/en-us/library/ms175935%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396
    Also, it possible to query the default trace to find autogrowth events, if you wanted you could write an alert/sql job based on this 
    SELECT
    [DatabaseName],
    [FileName],
    [SPID],
    [Duration],
    [StartTime],
    [EndTime],
    CASE [EventClass]
    WHEN 92 THEN 'Data'
    WHEN 93 THEN 'Log' END
    FROM sys.fn_trace_gettable('c:\path\to\trace.trc', DEFAULT)
    WHERE
    EventClass IN (92,93)
    hope that helps

  • How to Design Optimal Infocube

    Hi,
    Can any one explain how to design a optimal infocube, means how many dimensional tables to be maintain, and on wht basis r how to decide wch infoobjects should be maintained in dimensional table, and whn we go for line item dim., etc.....
    Regards
    Ramakrishna K

    Hi,
    We can always change the infocube desing unless there is no data in the cube.
    By desining means the the characteristics in the cube are rearranged in the dimensions to make the size of the dimension table as optimal as possible and that is done through the logical grouping of the characteristicsinside the dimensions.
    Just identify the chars which are logically related that is whose combinations doesn't changes frequently.It will result in less no of records and the drilldown during the report execution will be consume less time.
    It's always when you go for optimal design check or the peformace check.
    One of the exapmle is the program SAP_INFOCUBE_DESIGNS which gives you the ratio of the sizes of the various dimension table.
    This is used to check to make sure that the ratio of the dimension tbale size should not increares more then the total size.
    In other owrds no dimension tbale should have size more then 11% of the total size.
    you can see the incorrect entries in red in this program.
    One you get the error for particular table then you will have to rearrange the the chars of dim table that could include removing from one dim table and adding into another untial you get accurate dim tables..
    This is one of the handy exapmles there can be may more depending upon the scenarios.
    Hareesh

  • How to design Master datas?? Whats is Time Scenarios???Explain..

    How to design Master datas?? Whats is Time Scenarios???
    Can anybody explain about Time Scenarios???

    Hi..
    to tell it is huge ..
    but a slice of it 
    Design          – Create design documents
    Prod.          – Make the product
    Quality          – Confirm quality of product
    Sales          - Market the product
    Purchase                    – Procure the items
    Accounts                       To control the cost of Mfg
    These steps should be understood as a general approach. To what extent they must be carried out depends
    on the actual situation and the experience of the project members involved.
    After deciding on the business process being dealt with, the basic steps to implementing a BI based solution
    are:
    1. Focus on the structure of information
    Develop a complete understanding of the underlying business processes. Create an Entity Relationship
    Model (ERM) of the business process
    The ERM as a function of the information
    2. Focus on analytical needs - Overcome model complexity
    Create a valid data model. Translate the ERM to the Multi-Dimensional Model (MDM) / Star schema
    The MDM as a function of the analytical processing
    3. Build the solution as a part of an integrated data warehouse
    The Star schema on the BI stage are the InfoCubes. Translate the MDM / Star schema to one or more
    InfoCube.
    coming to time ..
    How real-world changes are dealt with, i.e. how the different time aspects are handled is the most
    important topic with data warehouses.
    The attributes of a characteristic that will reside in its master data table are determined in the modeling
    phase. Each attribute can be defined individually as being time dependent:
    There is one ‘time dependent’ check box for each attribute in the ‘attribute’ tab page section.
    Time dependency of an attribute allows you to keep track on the changes over time of the relation of the
    characteristic and the time dependent attribute values.
    In terms of technical implementation, two master data tables exist if we have both non-time dependent
    and time dependent attributes.
    One master data table stores all relations to non-time dependent attributes (name of the table:
    /BIC/P<InfoObject name>) and
    One table stores relations to time dependent attributes (name of the table: /BIC/Q<InfoObject
    name>).
    The time dependent attributes master data table has additional DATETO and DATEFROM system
    attributes. In queries the different constellations are addressed using the key date ( Query properties).
    The validity attributes are not available for navigation.
    The text table, or better the description attributes, may be defined as time dependent.
    SID tables with respect to master data:
    The SID table is always generated if an InfoObject is not defined as ‘attribute only’ (tab page general).
    This table is used if the access to an Infocube or DataStore Object uses a navigational attribute or if the
    access is via a characteristic without attributes. Name of the table: /BIC/S<InfoObject name>
    The non-time dependent attribute SID table of a characteristic for access via non-time dependent
    attributes. Name of the table: /BIC/X<InfoObject name>
    The time dependent attribute SID table of a characteristic for access via time dependent attributes.
    Name of the table: /BIC/Y<InfoObject name>
    with regards,
    hari kv

  • How to design this report ?

    Hi experts,
    How to design the customer total outstanding report as on a particular date ?
    We also want Debit amount and Credit amount in the query output..
    Regards,
    Nishuv V.

    HI,
    if u want the current date u go for the customer exit (that means daily)if he wants aparticular date then u go for the user entry variable in 0calday,in variable screen he sould mention the date for that date only the out standing report will come .0calday and customer u keep in rows and those debit and credit u keep in the columns.
    if daily as on date they want outstanding u go for the customer exit just u create the variable on 0calday with customer exit if variable name is 'zcedate' go to the tcode CMOD and write the below mention code.
    when 'zcedate'.
    clear l_s_range.
    l_s_range-sign = 'i'.
    l_s_range-opt = 'eq'.
    l_s_range-low = sy-datum.
    append l_s_range to e_t_range.
    Thanks  for giving this opportunity.
    Thanks & Regards
    k.sathish

  • How to design the report?

    Hi,
    how to change the filling data in report by vertical way?
    for eg: i am creating a group (group by userId) and displaying user name and access rights info;
    User Name   Access Rights
    TestUser      Adminuser
    TempUser    NotanAdminuser
    but i want in this format
    UserName        TestUser   TempUser
    AccessRights Adminuser  NotAnAdminuser
    how to design the report?

    i haven't tried using cross tab.
    but my requirement is like...
    Modified User Name ........ TestUser     Thendral    till 'n' number of users
    Total NO of Patients..........10                    5
              Heart Failure...........5                      1
              Surgical..................1                      2
              Pneumonia             3                      1
              Chest Pain             1                       1
            till 15 rows
    How to achieve this using crosstab?

  • How to design a 3D database in SDO

    Hi,
    I need to design a 3D database in Oracle9i SDO. As we know, this SDO support the 2D GIS seamlessly. How to design a 3D database in Oracle9i SDO,
    Could any person have some experiences. Thanks!
    Best regards!

    Hello All!
    Due to my diplom thesys I have to create a real 3D (not 2 1/2D) database in Oracle. You seem to have a little experience in this subject and I hope you can tell me whether my plan is possible or not...
    The data I'd like to store in the database is/are BRep, means a 3D-Objekt composed of many coplanar 2D-planes. I think storing the data won't be the problem because I can store the vertices of the 2d-polygons with x,y,z values. The queries will be the main problem. I have to query all types of intersection, neighborhood and some distance between the objects.
    I know, SDO_RELATE is the only filter which supports three dimensions, but there's something I don't understand:In the spatial user's guide it says:
    "the SDO_RELATE operator, can be used to determine with certainty if objects interact spatially".
    WHAT does this mean in case of 3D? True if the two objects intersect, false if not?
    Hongwei: How is your project doing? maybe we can exchange some experience...
    Many Questions, hoping for some help...;-)
    regards from germany,
    Markus Reuter

  • How to design HTML Table in ADF

    I am new to ADF Tech,
    I would like to know, how to design the HTML Table Rows and Columns in ADF
    Ex:
    <TABLE width="100%" border="1">
    <TR>
         <TD>GUID</TD>
         <TD>123</TD>
         <TD>Name</TD>
         <TD>Mark Antony</TD>
         <TD>Version</TD>
         <TD>1.0</TD>
    </TR>
    <TR>
    <TD>Created</TD>
         <TD>Oracle</TD>
         <TD>Modified</TD>
         <TD>Oracle User</TD>
         <TD>Placements</TD>
         <TD>20</TD>
    </TR>
    </TABLE>
    Thanks in Advance

    Balaji,
    With JSF in general (and ADF Faces too), you should not think in terms of HTML output, but in terms of JSF components. ADF has an af:table component that renders things in rows-and-columns, but emits HTML that is much more complex than just a simple HTML table.
    John

  • How to design templates with Microsoft Excel

    Hi
    When creating a new template in EBS, we have "Microsoft Excel" as one of the the template types (just like RTF). How to design the template if Excel is selected as the template type. I uploaded a blank EXCEL file and the concurrent program errors out with "Excel Processing" exception.

    hi,
    r u uploading the blank excel..r the excel u got from the Analyzer for Excel from the BIpublisher.
    One small clarification on my previous post..like the .xdo not the excel name.Inside the excel it is the sheet name.
    If u uploading the excel that u got from the Analyzer for excel means it should work.
    Plz select the template type as Excel after uploading the template.
    Its working for me.
    This link will be helpful for u
    http://blogs.oracle.com/xmlpublisher/2007/05/16/
    Edited by: Ananth.v on Mar 4, 2010 3:07 PM

  • How to design a particular screen?

    Hi All,
    In my apllication i am working on oracle forms using manually. I would to design a
    particular page with the following attributes as shown below?
    How to design sunch kind of pages.
    Column names
                                       Expir
    Reocrd Year Mnt Ct Mnt Year Fuel Fuel code Mine type Reported fips source name
    Type
    {select list} {Text item} {text Item} {Select list} {Text Box} {Text box} {Text box} {select list} {select list} {text item} {select item} {text item}
    till Mine type i do not have any scrolling type, But from reported onwards a scroll should apper so that i can scroll to right and seen what are the attributes
    still exists.
    Since this is a form, how can we maintain or develop the screen.
    Hope u have understood my problem.
    Or can anybody give let me know how to display or attache my screen shot, so that u may clear idea on this.
    Thanks,
    Anoo..
    Edited by: Anoo on Mar 2, 2010 4:38 AM

    Hi Ben,
    How do we use tabular form can u let me know the procedure to design it? bec i have not aware of that.
    -Anoo..
    Edited by: Anoo on Mar 2, 2010 4:41 AM

Maybe you are looking for

  • How can I correct an iCloud ID? I have a valid Apple ID.

    For an iPod 8 touch, how can I change an incorrect iCloud ID?  It has one missing letter. My apple ID is correct.  Since the iCloud email is an incorrect one I cannot put in a password to verify it.  So how do I correct the wrong iCloud ID?

  • Error while Applying patch KW70014

    Hi , I am facing the given error below while importing the patch KW70014.This is a BW patch .      The import was stopped, since an error occurred during the phase      IMPORT_PROPER, which the Support Package Manager is unable to resolve      withou

  • How do you Backup Canon VIXIA HF10 files for FCP?

    Hi, I just bought a Canon VIXIA HF10, wonderful!! I'm trying to import the captured/recorded files into FCP..i found that's a problem.. When i drag and drop all the files and folder on my desktop and when i deleted 1 of the file in the backup folder.

  • Create text inside a path

    I have a shape that I have drawn Everytime I try to copy and paste text into the shape I get the message that I I must click on a non-compound non masked path to create text inside path. Can anyone help?

  • Problem installing Forte CE 4.0 on W2K

    Hi, The problem is that I can�t install Forte on W2K. InstallShield Wizard starts but then nothing happens, I don�t know the reason, no messages are shown, any idea ? Thanks Mar