How can i place button on top right hand corner of the tabbed pane
Hi all,
i want to place button on top right hand corner of the tabbed pane, just run the code below, i have add button(it going to insert tab into tabbedpane), i want to place that tab into top right hand corner of the tabbedpane (not inside the tab itself). if i set tab policy setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT), it will give two button at right hand corner along with those buttons i want to and one more add button.
please suggest so that i can move forward.
Thanks in advance
import java.awt.Dimension;
import java.util.HashMap;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
* @author Dayananda.BV
public class TabpaneDemo extends javax.swing.JFrame {
/** Creates new form TabpaneDemo */
HashMap<Integer, tabpanel> panelMap = new HashMap<Integer, tabpanel>();
public TabpaneDemo() {
initComponents();
createFloorPlan();
getContentPane().setPreferredSize(new Dimension(400,400));
jTabbedPane1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
add_tab_button = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
add_tab_button.setText("+");
add_tab_button.setMargin(new java.awt.Insets(0, 0, 0, 0));
add_tab_button.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
add_tab_buttonActionPerformed(evt);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(308, Short.MAX_VALUE)
.addComponent(add_tab_button, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(67, 67, 67))
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(add_tab_button)
.addGap(8, 8, 8)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE))
pack();
}// </editor-fold>
private void createFloorPlan(){
tabpanel floorplan_Panel = new tabpanel(panelMap.size()+1);
panelMap.put(floorplan_Panel.getTabIndex(), floorplan_Panel);
jTabbedPane1.add(floorplan_Panel, floorplan_Panel.getTabName());
jTabbedPane1.setSelectedIndex(jTabbedPane1.getTabCount()-1);
private void add_tab_buttonActionPerformed(java.awt.event.ActionEvent evt) {
createFloorPlan();
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TabpaneDemo().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JButton add_tab_button;
private javax.swing.JTabbedPane jTabbedPane1;
// End of variables declaration
class tabpanel extends JPanel{
private int tabIndex = 0;
private String tabName ;
public tabpanel(int tabIndex) {
this.tabIndex = tabIndex;
if(tabIndex >= 10) {
tabName = "Floor Map"+tabIndex;
} else{
tabName = "Floor Map"+tabIndex+" ";
public int getTabIndex(){
return tabIndex;
public String getTabName(){
return tabName;
}Thanks
Dayananda B V
This part of tabbed pane is not customizable as it lies in the ComponentUI(TabbedpaneUI) portion of the tabbedpane.
But I can point out the place u can change to bring the desired feature into effect.
U can find an Inner class called ScrollableTabSupport
Look for the methods createButtons where u can create extra buttons and add to the tabbed pane.
The Inner class also implements actionListener where u can implement the action for the button u added.
By this method U have to use your own extended TabbedPaneUI which u cant escape from.
Hope this will help u.
Similar Messages
-
for example, those of you running windows, if you key;
start/computer/C drive you will notice a search bar in tope right hand corner. Can this happen in Firefox.Go to this address: http://mycroft.mozdev.org/search-engines.html?country=AU
Item 24 lists 3 installable major search engines for Australia.
You can also restrict your search in Google by including ''country:au'' or ''location:au'' or ''city:perth'' (for example) in your search terms. Example: ''city:sydney plumbers'' in the Google search box will list plumbers in cities named sydney. -
I updated to itunes 11.1 in Windows 8 & now there isn't a device tab in the top right hand corner or the sidebar. When I ran diagnostics it didn't pick up my Ipad or Iphone. Has anyone else had this problem & does anyone know how to fix it?
I have restarted my computer, turned my devices off & then on again & reinstalled itunes & none of this has helped.I have the same problem. Emailed apple--no help
-
Every time I press the shift key, command key, option key, control key, or function key it shows it's symbol in the top right hand corner of the screen. It also locks in shift until I press shift again. Please help me get this off of my computer, it's driving me crazy!!
Launch the System Preferences application. Open the Universal Access preference pane. Select the Keyboard tab. Disable the "Sticky Keys" option. Close System Preferences.
-
When I plug in my iPod touch 5th generation the small battery in the top right hand corner shows the charged sign. The big battery that shows up in the middle still shows it is charging. I've already been 2 the apple store & it didn't help any. Any ideas?
She restarted it or something. I don't know the exact process but she said don't worry the only thing you'll lose is your background. But I took a picture of the screen when it is charging so I have proof
-
I think I said everything I needed to in my "Topic" comment. Thank you for any suggestions
Welcome to Apple Support Communities.
I'm not running 10.5.8 and it's been a while, but in your browser (Safari, right?) click on the word 'View' in the top menubar and you should see 'Show Toolbar' right at the top, as well as other choices. Clicking 'Show Toolbar' should restore your 'address bar' back to the way you expect it to look.
Some websites purposely open a new window without any 'distractions', such as to play video clips. If you close the original window, you can be left without the familiar tools.
'Customize Toolbar' also lets you drag other defined buttons to add functions you use frequently that usually require navigating the menubar. I added a 'Print' button that was not part of the original set, for example.
Message was edited by: kostby -
please refer to above question
- Restore to factory settings/new iOS device.
If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
Apple Retail Store - Genius Bar
Apple will exchange your iPod for a refurbished one for $99 fr a 16 GB 4G. They do not fix yours.
Apple - iPod Repair price -
The search box in top right hand corner of the firefox window has disappeared.
Search box has just disappeared. Everything else seems to be as per normal. Don't know what I did to make it disappear but it has and I can't figure out how to get it back.
Hello,
# Try restore the Firefox layout to default.
# Go to Menu bar(Press Alt or F10 to show).
# Go to '''View''' >> '''Toolbars''' >> '''Customize'''.
# At the bottom of the window click on '''Restore default'''
# See more [http://mzl.la/LEfUYU Customize Firefox controls, buttons and toolbars] -
when FF 3.6.8 loads it loads everything except the the classic window buttons (minimize, maximize and exit ) do not appear in the top right hand corner as the normally would. it seems as though the page has been cut off or the monitor screen is to little for the whole page to load.
It is possible that the screen is too wide or too high.
Open the system menu via Alt+Space and see if you can resize that window.
If that works then close Firefox to save that setting.
See also http://kb.mozillazine.org/Resizing_oversize_window -
Just wondering how much it would cost to get the back of my iPhone fixed it has a few scratches & a tiny crack in the top right hand corner on the back of the iPhone. Thanks in advance
You take it into Apple and ask for an "out of warranty" replacement. It will cost a (reasonable) fraction of the cost of a new iphone. The cost cannot be given as you do not say whereabouts in the world you are. You can get the price if you search appropriately the internet.
-
hello i purchased a movie recently and it shows in my Itunes library but will not transfer to my ipod. It has the Icloud icon in the top right hand corner of the cover and if i click on play it starts to download from Icloud again and it does this each time i wish to play it, the same now happens to all my purcased movies which of course uses additional ISP download allowance. Before the recent update and lay out of Itunes this didn't happen i just purchased a movie and downloaded it then synced it to my ipod and enjoyed it. But now this latest movie purchase will not download to my ipod. I have sent the problem to Itumes and if there is answer i havent received it. Appreciate any advice
regards johnHello hotsone,
You may need to download a lower resolution version of the movie in order for it to sync to your iPod.
iTunes: Sync purchased HD videos to iPod or iOS device
http://support.apple.com/kb/TS4223
Cheers,
Allen -
I have followed the steps above for downgrading iCloud storage options, but when I get to the screen to select a downgraded option, the Done button is grayed out and won't let me select a new option. I see a lock in top right-hand corner, but not sure where to go to unlock it.
Choose Apple () menu > System Preferences, then click the iCloud icon.
Click the Manage button.
Click Change Storage Plan.
Click Downgrade Options.
Enter your Apple ID password, then click Manage.
Choose your current plan, then click Done.
(from http://support.apple.com/kb/HT5527 ) -
How can I print in the right hand corner of the paper (no borders)?
How can I print in the right hand corner of the paper (no borders). I have Adobe 7.
Is that elements 7 or photoshop 7? It can make a difference.
What you can do is create a new document that is the size of the paper, then place your document in the new document. You can now align your document to the right side of the page.
Now print.
Borders can have two meanings here. You can add a border to an image such as a stroke for example. The other meaning is the printer has a non-printing area called a border.
In the former there is nothing to do as long as you did not add one. In the latter some printers do have a print to edge option, but it has to be a feature of that printer. It would be located in the print options. If the printer does not have such a feature, there is nothing you can do, short of manually cutting the paper with a paper cutter, scissors, or x-acto knife. -
I have an iphone4 and in the top right hand corner I have a padlock with an arrow circling it - what does it mean and how do I get rid of it ?
I have just found out it was the orientation lock lol ! Grrrrrrrrr Its puzzled me for weeks !!!!!!!!
-
In the line of tabs along the top of the screen, there used to be an extra tab with a + in it that you clicked to open a new tab, on the right hand end of the tabs. As the tabs always float left and new tabs appear on the right this was (in my opinion) the most logical place for it. However, now the only two places I am able to put this "tab" are at the extreme left, which is illogical seeing as the new tab appears on the right, or in the toolbar along with other tools. This is adequate, but I would prefer to see the "new tab" tab back where it was.
The option to put it on the far right of the tab ribbon was not working until this latest version of Firefox, by the way, but I'm sure you know this!Thanks. I don't know why it wouldn't just go back there when I tried putting it back? I didn't change anything, so I assumed the new "default" was over on the left. Glad it was a simple solution after all.
Maybe you are looking for
-
Please check for this account skype he is scammer
now he use skype call to me my mobile phone i'm IT Recruiter it's have more impact my occupation please delete and block this account i must delete my account . i must use skype for business but now i can not . now second time he send mail and u
-
Hi All, I am using the report/program RPT_MOPZ_COPY_STACK_XML to copy the stack xml file I used from a previous upgraded system. Systems are identical. However, report shows below.. "Software Component Version KRNL64UC7.20 [01200615320200013056] diff
-
I can't hear sounds from my ipad speaker
I just bought Ipad mini last 2 weeks....since I have bought ...I can not hear sounds from speaker. It always shows "headphone" mode....Why? Technician tried to restore but not work....What is your suggestion? Thank you.
-
Hi, I have iMac with most recent version of Mac OS X (Lion). I am looking to see if there is a 3rd party program to modify the contextual menu(when you right click) to provide additonal functionality. Does anyone have a utility to do this? Thanks an
-
Unable to do a Full backup due to missing archived Files
I had setup everything to do a full backup and when the job started, it failed. It seems not able to find the archived file. I had deleted the archived File earlier due to low storage space. Can anybody advised me ? Thanks in advance. ------From Job