JTabbedPane with non-tabbed text

OK, I'm stuck (again)
What I would like to do is have a tabbed pane (2 tabs) and then put some text (maybe in a JLable) on the same line as the tabs. I'll try to draw a picture for clearity. Anyone have any ideas about how to do this?
/ tab1 \ /tab2  \         Here is some text
================================
|    This is what changes                             |
|            when you switch tabs                     |
|                                                                        |
================================I think you can get the idea from that 'picture.'

The correct way is probably to override the TabbedPaneUI, but that too complicated for me, so here's a quick hack that might give you some ideas:
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.*;
public class TabbedPaneWithText extends JFrame
     public TabbedPaneWithText()
          JTabbedPane tabbedPane = new JTabbedPane()
               public void paintComponent(Graphics g)
                    super.paintComponent(g);
                    Rectangle lastTab = getUI().getTabBounds(this, getTabCount() - 1);
                    int tabEnd = lastTab.x + lastTab.width;
                    String text = "Some Text";
                    FontMetrics fm = getFontMetrics( getFont() );
                    int stringWidth = fm.stringWidth( text ) + 10;
                    int x = getSize().width - stringWidth;
                    if (x < tabEnd)
                         x = tabEnd;
                    g.drawString(text, x + 5, 18);
          tabbedPane.add("1", new JTextField("one"));
          tabbedPane.add("2", new JTextField("two"));
          getContentPane().add(tabbedPane);
     public static void main(String args[])
        TabbedPaneWithText frame = new TabbedPaneWithText();
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.pack();
        frame.setLocationRelativeTo( null );
        frame.setVisible(true);
}

Similar Messages

  • Not all chinese characters display correctly with non-embedded text

    Hi all,
      I've updated to the last beta 2 of Flash Player 10.1 (10,1,51,66) and compiled this simple Flex application to illustrate the fact that not all chinese characters can be displayed correctly with non-embedded text (device font).
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo"
                   minWidth="1024" minHeight="768"
                   creationComplete="resourceManager.localeChain = ['zh_CN'];"
                   layout="{new VerticalLayout()}">           
        <fx:Script>
            <![CDATA[
                import spark.layouts.VerticalLayout;
            ]]>
        </fx:Script>
        <s:Label text="伜-伞伟传伡伢伣伤伥伦伧伨伩伪伫伬伭-伝">
        </s:Label>
        <mx:Label text="伜-伞伟传伡伢伣伤伥伦伧伨伩伪伫伬伭-伝"/>       
    </s:Application>
      Notice that characters from the Unicode range 0x4F1E .. 0x4А2D are not displayed within <s:Label> component that uses Flash Text Engine (FTE) by default to display the text, but at the same time those characters display just fine within older <mx:Label> component that relies on flash.text.TextField instance to render the text.

        OK, did not know that "Arial Unicode MS" font is only distributed with Microsoft Office, was looking into relying on this font in case if "simsun.ttc" font is not available at the user's system, by using the following:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   minWidth="1024" minHeight="768"
                   creationComplete="resourceManager.localeChain = ['zh_CN']"
                   layout="{new VerticalLayout()}">               
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/halo";
            s|Label {
                fontFamily: "Arial Unicode MS, SimSun, Arial";            
        </fx:Style>   
        <fx:Script>
            <![CDATA[
                import spark.layouts.VerticalLayout;
            ]]>
        </fx:Script>
        <s:Label id="sparkLabel" text="伜-伞伟传伡伢伣伤伥伦伧伨伩伪伫伬伭-伝"/>   
    </s:Application>  
    Tough decision ahead, but accordingly to  the survey at codestyle.org (2000 participants from 2007 year and onwards), Arial Unicode MS is present at 62.53%% system surveyed.
    ps
       My current install of Windows XP already includes the install of Microsoft Office 2007 and I've also enabled/disabled the support of East Asian languages, thus the content of  my "fonts" folder differs now significantly from "clean" Windows XP install version.
    Nevertheless I found the page with comprehensive lists of standard fonts installed with different releases of Windows that looks viable here:  http://www.kayskreations.net/fonts/fonttb.html

  • Jtabbedpane with replacing tab content

    Hello,
    I am developing an applet that should contain a JTabbedPane with 2 tabs.
    The second tab is easy to do because ti contains one Jpanel all the way.
    the first however is an issue, because i am supposed to change its content when the applet is running.
    this means i have 3 JPanels, J1, J2, J3.
    At tge beginning the applet contains J1 in the first tab.
    and J1 contains a button. when i click that button the applet should replace J1 with J2.
    the problem is i haven't managed to find a solution yet :(
    I have tried with setvisible(false) and validate(). It won't work. I also tried to add the J2 panel over J1, but encountered no succes.
    anybody has any idea ?
    Message was edited by:
    asrfel

    If you want to change back and forth repeatedly then wrap J1/2/3 in a JPanel with a CardLayout.
    If you can discard one when it's done with, use the remove() and insertTab() methods of JTabbedPane.

  • FTP Adapter : Issue with Non English Text.

    Dear All,
    We are trying to read a file which contains Korean Language and write into a different folder in a CSV format.
    The output file contains "???" inplace of Korean text.
    We can see the invoke to FTP adapter contains Korean text as part of it's input. But the CSV file contains "???"
    <FinalTradeCardList>
    <imp1:FinalRows>
    <imp1:C1>NO</imp1:C1>
    <imp1:C2>사이트코드</imp1:C2>
    <imp1:C3>사이트명</imp1:C3>
    <imp1:C4>승인일자</imp1:C4>
    <imp1:C5>주문번호</imp1:C5>
    <imp1:C6>주문자</imp1:C6>
    <imp1:C7>주문자연락처</imp1:C7>
    <imp1:C8>카드종류</imp1:C8>
    <imp1:C9>승인번호</imp1:C9>
    <imp1:C10>거래상태</imp1:C10>
    <imp1:C11>거래상태일시</imp1:C11>
    <imp1:C12>할부</imp1:C12>
    <imp1:C13>거래금액</imp1:C13>
    <imp1:C14>비과세공급가액</imp1:C14>
    <imp1:C15>과세공급가액</imp1:C15>
    </imp1:FinalRows>
    </FinalTradeCardList>
    What needs to be done in BPEL to get Korean Language text in CSV file.
    Thanks,
    Sid.

    Thanks for your reply.
    I used the character set as you suggested.But it is not getting converted correctly.
    Actual Value : (유)라이프테크놀로지스코리아
    Converted Value : ( $)C @/ ) 6s@LGAEWE)3n7NAv=:DZ8.>F
    I tried all others that are mentioned in the document. Still i am seeing different values. I am not getting the actual value.
    But in BPEL i see correct value getting passed to FTP Adapter.
    The character set is in XSD. Please find it below..
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
                xmlns:tns="http://TargetNamespace.com/DeleteMe"
                targetNamespace="http://TargetNamespace.com/DeleteMe"
                elementFormDefault="qualified"
                attributeFormDefault="unqualified"
                nxsd:version="NXSD"
                nxsd:stream="chars"
                nxsd:encoding="ISO-2022-KR">
      <xsd:element name="Root-Element">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Row" minOccurs="1" maxOccurs="unbounded">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;" />
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
    Please review the above and help me in resolving this issue.
    Thanks,
    Sid.

  • FileMerge at Mountain Lion "cancelling any way" with non-ascii text files

    With Lion, it displays a warning, if we click "Proceed anyway", it will properly diff the files
    With Mountain Lion, in this case, after "Proceed anyway", it goes away silently, equivalent to clicking "Cancel".

    I am not sure if I am the only one encounter this:
    case 1:
    File A:
    Hello你好
    File B:
    Hello你好-2
    FileMerge can't diff them!
    but if they are
    File A:
    Hello你好
    Second line: A
    File B:
    Hello你好
    Second line: B
    FileMerge is able to diff them!
    I take Thomas's point. Probably it's a problem of Xcode - I will post to Developer forum.

  • PDF Export with Outlined Text, keeps non-outlined text box behind

    I work with a printer that needs all text outlined and the file saved into a PDF.
    Everytime I outlined my txt another box with non outlined text remains in the background.
    I have to go through my document deleting the non outlined text boxes...seriously.
    Anyone have a solution for this or have experienced anything similar?

    I agree with the gentlemen above, but have on occasion been forced to outline fonts for printers as I have no authority to choose which printers my company works with.
    Well put, Allison. I don't have any control over the printers used by my clients' clients, either. Or my clients' clients' clients. So occasionally the word comes back up the chain "All of the Arabic turned into question marks; please outline and resend."
    Speaking of which: the cases in which live text is duped when converted to outlines, with one copy remaining live, are in my experience 1) when tables are used, and 2) when almost any Middle East version of InDesign is used. I think that maybe the leave-live-text-behind bug/feature has been fixed in ME edtions of CC but I'm not sure.

  • Selecting non-consecutive text in Safari text boxes?

    I've been trying to find a way to highlight/select different ranges of text in Safari without luck; I know that selecting consecutive text can be done by holding down "shift", but is there any way to do it with non-consecutive text? TextEdit is able to do this -- I can select a word in one paragraph, hold down the "command" key, and then separately highlight a word or sentence in another paragraph.

    Apple - Safari - Feedback

  • JTabbedpane with JRadiobutton?

    I have a JTabbedpane with 2 tabs (tab1, tab2).
    I have 2 radiobutton (JRadioButton).
    So for now, i want to when i click on radiobutton1 it will be show tab1
    when i click on radiobutton2 it will be show tab2.
    Here is my source code, please help me to slove it:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.GridBagLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.BorderFactory;
    import javax.swing.ButtonGroup;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    public class JTablePaneTest extends JFrame implements ActionListener{
    private JTabbedPane pane;
    private JRadioButton radioButton1 = new JRadioButton("Radiobutton1", true);
    private JRadioButton radioButton2 = new JRadioButton("Radiobutton2", false);
    JPanel radioPanel =null;
    public JTablePaneTest() {
    super("TEST");
    this.setLayout(new BorderLayout());
    this.setSize(new Dimension(300,300));
    this.getContentPane().add(this.getAllRadioButton(), BorderLayout.SOUTH);
    this.getContentPane().add(this.getPane(), BorderLayout.CENTER);
    this.pack();
    this.setVisible(true);
    private JPanel getAllRadioButton(){
    if(radioPanel==null){
    radioPanel = new JPanel();
    radioPanel.setLayout(new FlowLayout());
    radioPanel.setBorder(BorderFactory.createEmptyBorder());
    ButtonGroup bg = new ButtonGroup();
    bg.add(radioButton1);
    bg.add(radioButton2);
    radioPanel.add(radioButton1);
    radioPanel.add(radioButton2);
    return radioPanel;
    private JTabbedPane getPane(){
    if(pane == null){
    pane = new JTabbedPane();
    pane.addTab("Tab1", null, panel1(), "Tab1");
    pane.addTab("Tab2", null, panel2(), "Tab2");
    return pane;
    private JPanel panel1(){
    JPanel panel1 = new JPanel();
    panel1.setLayout(new GridBagLayout());
    panel1.add(new JButton("TEST1"));
    return panel1;
    private JPanel panel2(){
    JPanel panel2 = new JPanel();
    panel2.setLayout(new GridBagLayout());
    panel2.add(new JTextField(12));
    return panel2;
    public static void main(String[] args) {
    new JTablePaneTest();
    @Override
    public void actionPerformed(ActionEvent e) {
    if(e.getSource() == radioButton1){
    //show tab1
    if(e.getSource() == radioButton2){
    //show tab2
    }Thanks you very much.
    Edited by: ecard104 on Sep 1, 2008 10:01 AM

    ecard104 wrote:
    can you tell me the method you want to say?I'd prefer to have you look at the API and the tutorial. It would be better for you in the long run. It's spelled out in the tutorial.
    [http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html]
    [http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html]
    Edited by: Encephalopathic on Sep 1, 2008 10:17 AM

  • JTabbedPane vertical tab text bottom alignment

    In the following example, how can we have the tab component labels ("test" and "test test") bottom aligned ?
    Note that it also uses this class: [http://www.camick.com/java/source/VerticalLabelUI.java]
    import java.awt.*;
    import javax.swing.*;
    public class NewJFrame extends JFrame {
        private JTabbedPane pane;
        public NewJFrame() {
            //http://www.camick.com/java/source/VerticalLabelUI.java
            VerticalLabelUI ui = new VerticalLabelUI();
            pane = new JTabbedPane();
            pane.setUI(new MyUI());
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            getContentPane().add(pane, BorderLayout.CENTER);
            setSize(400, 300);
            setLocationRelativeTo(null);
            pane.addTab("tab1", new JLabel("Test1"));
            pane.addTab("tab2", new JLabel("Test2"));
            JLabel labelTab = new JLabel("<html><font color=red>Test");
            labelTab.setUI(ui);
            labelTab.setHorizontalAlignment(SwingConstants.LEFT);
            pane.setTabComponentAt(0, labelTab);
            labelTab = new JLabel("<html><font color=red>Test Test");
            labelTab.setUI(ui);
            labelTab.setHorizontalAlignment(SwingConstants.LEFT);
            pane.setTabComponentAt(1, labelTab);
        public static void main(String args[]) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NewJFrame().setVisible(true);
    }Note that I tried already to override BasicTabbedPaneUI.layoutLabel(), playing around with SwingUtilities.layoutCompoundLabel() text alignment parameters without anything happening on screen.

    Note that it also uses this classI have that class, but where to I get MyUI? Anyhow. After commenting out the line I couldn't compile, I could see the problem isn't with where the text is being placed in the label but rather where the label is being positioned on the tab. One way out is for all your labels to have the same preferredSize.height.import darrylbu.plaf.vertical.VerticalLabelUI;
    import java.awt.*;
    import javax.swing.*;
    public class TestJFrame extends JFrame {
      private JTabbedPane pane;
      public TestJFrame() {
        //http://www.camick.com/java/source/VerticalLabelUI.java
        VerticalLabelUI ui = new VerticalLabelUI();
        pane = new JTabbedPane();
        //pane.setUI(new MyUI());
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        getContentPane().add(pane, BorderLayout.CENTER);
        setSize(400, 300);
        setLocationRelativeTo(null);
        pane.addTab("tab1", new JLabel("<html><div align = \"left\"><font color=red>Test</font></div></html>"));
        pane.addTab("tab2", new JLabel("Test2"));
        JLabel[] tabLabels = new JLabel[2];
        tabLabels[0] = new JLabel("<html><font color=red>Test");
        tabLabels[1] = new JLabel("<html><p style = \"text-align:left\"><font color=red>Test Test</font></p></html>");
        int height = 0;
        for (JLabel tabLabel : tabLabels) {
          tabLabel.setUI(ui);
          height = Math.max(height, tabLabel.getPreferredSize().height);
        System.out.println(height);
        for (int i = 0; i < tabLabels.length; i++) {
          tabLabels.setPreferredSize(new Dimension(tabLabels[i].getPreferredSize().width, height));
    pane.setTabComponentAt(i, tabLabels[i]);
    public static void main(String args[]) {
    EventQueue.invokeLater(new Runnable() {
    public void run() {
    new TestJFrame().setVisible(true);
    db

  • Why can't I text with non Apple equipment?

    Why can't I text with non Apple equipment?

    You can with third party apps. You just can't use Messages in order to text since it only works with other iOS devices and Macs running Mountain Lion.
    https://www.google.com/search?q=texting%20apps%20for%20iPad

  • When I send a text message to my two children with non-smart phones, the message comes throug blank. When I send a message to them one at a time it will go through but not multiple addresses. Can this problem be fixed?

    When I send a text message on my iPhone 4s to my two children with non-smart phones, the message comes through blank. If I send it to each one individually, it will go through ok. Is this a problem with my phone or it is something I am doing wrong.

    Check your phone to make sure MMS is turned on. If it is, check with your cell provider and make sure your phone is provisioned correctly.

  • Upload text files with non-english characters

    I use an Apex page to upload text files. Then i retrieve the contents of files from wwv_flow_files.blob_content and convert them to varchar2 with utl_raw.cast_to_varchar2, but characters like ò, à, ù become garbage.
    What could be the problem? Are characters lost when files are stored in wwv_flow_files or when i do the conversion?
    Some other info:
    * I see wwv_flow_files.DAD_CHARSET is set to "ascii", wwv_flow_files.FILE_CHARSET is null.
    * Trying utl_raw.cast_to_varchar2( utl_raw.cast_to_raw('àòèù') ) returns 'àòèù' correctly;
    * NLS_CHARACTERSET parameter is AL32UTF8 (not just english ASCII)

    Hi
    Have a look at csv upload -- suggestion needed with non-English character in csv file it might help you.
    Thanks,
    Manish

  • Text Messaging in Japanese (or other language with non-Roman script)

    Is it possible to send/receive text messages written in non-Roman characters with Verizon? 
    More specifically, I'm using a Droid 2 with Verizon, and I'm trying to text a friend in Japanese.  She has an iPhone (AT&T), and is physically in the U.S. (so I'm not asking about international text messaging).  I've already installed apps on my Droid (e.g. OpenWNN, or Simeji) to input Japanese, which work fine in and of themselves, and the Droid of course displays Japanese text or other languages just fine on the Browser or in E-mails.
    However, I'm having lots of trouble with Text Messaging.  When I send a message containing Japanese text (typed in perfectly fine with OpenWNN or whatever), she either never gets the message, or the text comes out unreadable (as ???????).  Messages with a mix of Roman and non-Roman characters typically show the Roman characters ok, but the non-Roman ones (i.e. Japanese) are garbled.  If she sends me a message containing any non-Roman characters, I generally don't get the message at all (i.e. not even garbled-- just no message at all).   This deficiency seems to be specific to Text Messaging, as far as I can tell.  I can send and receive e-mails containing Japanese just fine, read foreign language web pages, and type in Japanese into search boxes on those web pages and so on with the Droid.  However, sending an e-mail message to (myphone#)@vtext.com, predictably, results in any Japanese text being garbled, though Roman characters come through just fine.
    Is this perhaps something specific to Verizon's network?  Or is text messaging in non-Roman scripts just inherently impossible?  My friend says she knows others who can successfully text in non-Roman scripts (e.g. Korean Hangul, Japanese Kana or Kanji), and claims some of these folks are Verizon customers too.  A search on droidforums.com yielded someone who supposedly could text in Korean within Verizon.  So, I'm hoping this is possible, and I'm just missing something. However, this is perhaps all secondhand information and rumor.
    (Incidentally, I know for certain that messaging with non-Roman scripts is possible in general.  During my last vacation in Japan, I rented a phone there, and could send messages in English or Japanese scripts.  However, I believe the phones there actually have their own e-mail addresses, and so the service there is more like regular e-mail-- my understanding is that text messaging as we know it in the U.S. is a distinct technology, though I could well be wrong.)
    So, to restate my question: is it possible to text message with non-Roman scripts with Verizon?  Has anyone out there done this successfully-- if so what did you do, or what app did you use?  Or is it in fact impossible? (e.g. Maybe text messaging here only uses 7 or 8 bits, instead of 14 or 16 needed to encode all the various Asian, European, and other scripts?)
    Thanks for any help available.

    I'm trying to figure this out as well, but my understanding on the matter is that Verizon's CDMA network uses unicode which will display, roman characters, loa, thai, and serveral other languages, but not hirigana, kanji, katakana, or simplified or traditional chinese.  The Romaji should work however.  It would be nice to hear some input from a Verizon rep on the subject, because like you my info is all second hand.
    If my understanding is correct, the simple answer is no, it's not possible.  

  • Problem with Text Messaging on new iphone with non iphone users

    Ever since I set up imessage forwarding to be able to send/receive text messages on both my mac book pro and iphone people with non iphones are not getting my text messages from either device. 
    In my settings - messages - text message forwarding it only has one device enabled which is my mac book pro.  There is an option to enable my iphone. Do I need to do that? I did try and it's asking me for a code.  If i do need to do this where on my phone do i get this code? Thank you.

    Have you tried reporting the problem to AT&T?

  • Problem with non iPhone users receiving my text sent pictures. Can I make them smaller files?

    Problem with non iPhone users receiving my text sent pictures.  Can I make them smaller files? I know that is possible for email sent pics.

    My bad,  It was a Verizon problem.  When they upgraded my phone they were supposed to remove all blocks on messaging . Found out they did not do this.  All messaging now works.  Thanks for listening.

Maybe you are looking for

  • Need help in Creating a sequence

    Hi, I need to create a sequence which starts with the value one more than max value of one of the columns in a table. Can anyone help me in this regard? Eg: I have a table 'User_Details' with one of the columns as 'ID', I need to create a sequence fo

  • Same iTunes account but on different computers?

    My husband and I have both got iphone 4s that are on seperate computers but the same itunes account. We have enabled the cloud so obviously have merged contacts and calendars which is what we want but his calendar is from his PC and we want it from m

  • Tricky problem in Bex report

    Hi, experts,     In our Bex reports, If I set the figure format(scaling and decimal) with "change query (local view ..)", then customized layout(add drill down, keep filter ..). It's works fine.     But, If I do customized layout firstly, then go to

  • Link to a URL but not using popup

    I am trying to access anHTML file that loads an interactive swf file created in Flash with external links to XML and graphic files. I need to present the interactive swf file and still have access to the navigation click boxes on the slide that loads

  • New client Throttling policy on Exchange 2010

    Hello, I have a user that issues some discovery searches. These searches are putting alot of strain on the Exchange 2010 server and affecting performance. I would like to create a new throttling policy for this 1 user (I know that everything this 1 u