{"id":64888,"date":"2025-05-03T11:01:46","date_gmt":"2025-05-03T03:01:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/64888\/"},"modified":"2025-05-03T11:01:46","modified_gmt":"2025-05-03T03:01:46","slug":"jtabbedpane-%e7%b1%bb%e4%b8%ad%e7%9a%84-add-%e5%92%8c-addtab-%e6%96%b9%e6%b3%95%e6%9c%89%e4%bd%95%e5%8c%ba%e5%88%ab%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/64888\/","title":{"rendered":"JTabbedPane \u7c7b\u4e2d\u7684 add() \u548c addTab() \u65b9\u6cd5\u6709\u4f55\u533a\u522b\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173087301331810.jpg\" class=\"aligncenter\" title=\"JTabbedPane \u7c7b\u4e2d\u7684 add() \u548c addTab() \u65b9\u6cd5\u6709\u4f55\u533a\u522b\uff1f\u63d2\u56fe\" alt=\"JTabbedPane \u7c7b\u4e2d\u7684 add() \u548c addTab() \u65b9\u6cd5\u6709\u4f55\u533a\u522b\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>jtabbedpane \u7c7b\u4e2d\u7684 add() \u548c addtab() \u65b9\u6cd5<\/strong><\/p>\n<p>jtabbedpane \u7c7b\u63d0\u4f9b\u4e24\u79cd\u6dfb\u52a0\u9009\u9879\u5361\u7684\u65b9\u6cd5\uff1aadd() \u548c addtab()\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>\u8fd9\u4e24\u79cd\u65b9\u6cd5\u7684\u4e3b\u8981\u533a\u522b\u5728\u4e8e\u5b83\u4eec\u7684\u8fd4\u56de\u503c\uff1a<\/p>\n<ul>\n<li> <strong>add()\uff1a<\/strong>\u8fd4\u56de\u6dfb\u52a0\u5230\u9009\u9879\u5361\u4e2d\u7684\u7ec4\u4ef6\u7684\u7d22\u5f15\u3002<\/li>\n<li> <strong>addtab()\uff1a<\/strong>\u8fd4\u56de\u6240\u521b\u5efa\u7684\u9009\u9879\u5361\u7684\u7d22\u5f15\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86 add() \u548c addtab() \u65b9\u6cd5\u4e4b\u95f4\u7684\u533a\u522b\uff1a<\/p>\n<pre>import javax.swing.jtabbedpane;\n\npublic class jtabbedpanedemo {\n\n    public static void main(string[] args) {\n        jtabbedpane tabbedpane = new jtabbedpane();\n\n        \/\/ \u4f7f\u7528 add() \u65b9\u6cd5\u6dfb\u52a0\u7ec4\u4ef6\n        component component1 = new jlabel(\"\u6807\u7b7e 1\");\n        int componentindex = tabbedpane.add(\"\u6807\u7b7e 1\", component1);\n\n        \/\/ \u4f7f\u7528 addtab() \u65b9\u6cd5\u6dfb\u52a0\u9009\u9879\u5361\n        component component2 = new jlabel(\"\u6807\u7b7e 2\");\n        int tabindex = tabbedpane.addtab(\"\u6807\u7b7e 2\", component2);\n\n        system.out.println(\"\u6dfb\u52a0\u7684\u7ec4\u4ef6\u7d22\u5f15\uff1a\" + componentindex);\n        system.out.println(\"\u521b\u5efa\u7684\u9009\u9879\u5361\u7d22\u5f15\uff1a\" + tabindex);\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<pre>\u6dfb\u52a0\u7684\u7ec4\u4ef6\u7d22\u5f15\uff1a0\n\u521b\u5efa\u7684\u9009\u9879\u5361\u7d22\u5f15\uff1a1<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7531\u6b64\u53ef\u89c1\uff0cadd() \u65b9\u6cd5\u8fd4\u56de\u7ec4\u4ef6\u7d22\u5f15\uff080\uff09\uff0c\u800c addtab() \u65b9\u6cd5\u8fd4\u56de\u9009\u9879\u5361\u7d22\u5f15\uff081\uff09\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJTabbedPane \u7c7b\u4e2d\u7684 add() \u548c addTab() \u65b9\u6cd5\u6709\u4f55\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>jtabbedpane \u7c7b\u4e2d\u7684 add() \u548c addtab() \u65b9\u6cd5 jtabbedpane \u7c7b\u63d0\u4f9b\u4e24\u79cd\u6dfb\u52a0\u9009\u9879\u5361\u7684\u65b9\u6cd5\uff1aadd() \u548c addtab()\u3002 \u8fd9\u4e24\u79cd\u65b9\u6cd5\u7684\u4e3b\u8981\u533a\u522b\u5728\u4e8e\u5b83\u4eec\u7684\u8fd4\u56de\u503c\uff1a add()\uff1a\u8fd4\u56de\u6dfb\u52a0\u5230\u9009\u9879\u5361\u4e2d\u7684\u7ec4\u4ef6\u7684\u7d22\u5f15\u3002 addtab()\uff1a\u8fd4\u56de\u6240\u521b\u5efa\u7684\u9009\u9879\u5361\u7684\u7d22\u5f15\u3002 \u793a\u4f8b \u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86 add() \u548c addtab() \u65b9\u6cd5\u4e4b\u95f4\u7684\u533a\u522b\uff1a import javax.swing.jtabbedpane; public class jtabbedpanedemo { public static void main(string[] args) { jtabbedpane tabbedpane = new jtabbedpane(); \/\/ \u4f7f\u7528 add() \u65b9\u6cd5\u6dfb\u52a0\u7ec4\u4ef6 component component1 = new jlabel(&#8220;\u6807\u7b7e 1&#8221;); int componentindex = tabbedpane.add(&#8220;\u6807\u7b7e 1&#8221;, component1); \/\/ \u4f7f\u7528 addtab() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-64888","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=64888"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64888\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=64888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=64888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=64888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}