jtabbedpane

How to add close button to a JTabbedPane Tab?

旧时模样 提交于 2019-12-17 04:28:53
问题 I'm working in with a JTabbedPane, I need to add a close button in the tabs to close the current one. I have been searching and as I understand I must extend from JPanel and add the close button as they say here But, is there a way to add the close buttons extending JTabbedPane or is there a easier way to do it? Thanks in advance, I really appreciate your time and your help. 回答1: Essentially, you're going to need to supply a "renderer" for the tab. Take a look at JTabbedPane.setTabComponentAt

Java: JProgressBar (or equivalent) in a JTabbedPane tab title

让人想犯罪 __ 提交于 2019-12-17 03:17:45
问题 If I really wanted to do something like that, can I put a JProgressBar (or it's equivalent) in a JTabbedPane tab? (I mean, not in the tab itself, How would I do something like that? EDIT I really do want to put the progressbar in the title of the tab, not the tab itself. Here's some ascii art: ---------------------------------------------------- | Tab 1 || Tab 2||Tab-with-progress-bar||Tab 4| ----------- -------------------------------- ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ------------------------

Button action to change the color of all tabbedpane panel java swing

雨燕双飞 提交于 2019-12-14 03:21:20
问题 I have 2 tab(A and B) in tabbedpane. In A, I write only setBackground(Color.RED); In B, I put a Button. and the codes likes that: A a=new A(); jButton1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub a.setBackground(Color.BLUE); } }); I want to change the color of A from B's button action. But I failure. How can i solve this problem?? Thanks in advance... still my problem not solved. I am posting the whole code

creating the same jtable in 2 different JtabbedPanes

拈花ヽ惹草 提交于 2019-12-13 18:57:00
问题 I want to create 2 JTabbedPanes that will have the same JTable but different values in one of the columns. Right now for some reason only one of the tabs is showing up and I am not sure why. Also am I doing this the best way by creating 2 different DefaultTableModel 's? public static void tableMaker(DefaultTableModel m, DefaultTableModel m1, final Map<String, NumberHolder> uaCount) { final JFrame frame = new JFrame("Strings"); JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel();

Java: “Add Tab Button” for a JTabbedPane

让人想犯罪 __ 提交于 2019-12-13 11:45:36
问题 Is it possible to add a button to a tabbed pane like in firefox. The plus-button is what I want. Thanks 回答1: I think you should be able to manage it by building your own JTabbedPaneUI and setting it on the JTabbedPane using setUI . Your ComponentUI has methods to get a hold of the accessible children. If you specify a JButton and a JLabel then you may be in business. I haven't attempted this myself though. This is "at your own risk" :) 回答2: You can try this: public static void main (String[]

Using JTextarea with JTabbedPanel

人走茶凉 提交于 2019-12-13 06:04:31
问题 JTextarea is dynamically created and added to the jTabbed panel using the code: // tabidis is a variable with unique value in each case JScrollPane panel2 = new JScrollPane(); panel2.setName(tabidis); ta = new JTextArea(""); ta.setColumns(30); ta.setRows(20); ta.setEditable(false); panel2.setViewportView(ta); ta.setName(tabidis); jTabbedPane1.add(username4, panel2); When new tabs are added (ta textarea is added along with it), the last tabs textarea recieves all the text. private void

Java - Load JTabbedPane one tab after another

偶尔善良 提交于 2019-12-13 05:11:32
问题 I have a JTabbedPane with 4 tabs. I would like to load 1 tab 1 after another as the tabs uses, refers and retrieves from the same database. And this is causing an issue of "Database is locked" in my application. Thanks in advance for the help and suggestions :) This is how I create the JTabbedPane JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setBounds(0, 0, 450, 300); tabbedPane.addTab("tab1", new class1UseDb()); tabbedPane.setMnemonicAt(0, KeyEvent.VK_1); tabbedPane.addTab("tab2",

Detecting the table of an onChanged() event with multiple JTable in a JTabbedPane

我只是一个虾纸丫 提交于 2019-12-13 04:22:37
问题 I'm currently using a JFrame to hold a JTabbedPane that contains multiple tables. In my class that extends JFrame and implements TableModelListener , I have an onChanged() method that takes a TableModelEvent as an argument. I can successfully obtain data from the event on the table that the event was fired from, but I can't determine which table it was. From what I understand, this is not the way to do what I intend to do. I believe that I may need to write a custom TableModelListener or

Change jLabel Visibility

别等时光非礼了梦想. 提交于 2019-12-13 03:47:53
问题 I am new to Netbeans and Java and am having an issue with jLabels that are on jPanels. I have a jTabbedPane with a jPanel in it. I have a jLabel on the jPanel. I would like to set the visibility of the jLabel to false, but it does not seem to work. The label is still visible when I run the program. I do not understand why. Label label = new Label("jLabel1"); label.setVisible(false); 回答1: You can set it inside initComponents() ; package my.tt; public class NewJFrame extends javax.swing.JFrame

JTabbedPane mouseover paint issue

主宰稳场 提交于 2019-12-13 00:23:17
问题 I am working with an application that is experiencing painting issues on some users computers when the mouse passes over the tabs in a JTabbedPane. They also occasionally have similar issues on other interactive components like JButtons. I have only ever seen this error occur on mouse overs. The application is being run with 1.6.0_20 and I have already tried the flag recommended in update 10 in case it was an issue with D3D (-Dsun.java2d.d3d=false). Since I am a new user I cannot post a