⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jframemainview.java

📁 This is the complete Editor Using java
💻 JAVA
字号:
package com.JCreater;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
public class JFrameMainView {
	private static JSplitPane splitPane;
	private static JTabbedPane tabbedPane = new JTabbedPane(); 
	private static JTabbedPane tabedPaneFile;
	public static JTextArea textAreaFile;
	private static JScrollPane scrollPaneFile;
	private static JScrollPane scrollPaneOutput;
	private static JTextArea textAreaOutput;
	private static String selectedTabbed;
	public JFrame mainFrame;
	private static JFrameMainView INSTANCE = new JFrameMainView();
	public static final JFrameMainView getInstance() {
		return INSTANCE;
	}
	public static final void destoryInstance() {
		INSTANCE = null;
	}
	public static JSplitPane frameMainView() {
		textAreaFile = new JTextArea();
		textAreaOutput = new JTextArea();
		
		tabedPaneFile = addMyTabbedPane(textAreaFile, "Untitled 0");
		scrollPaneFile = new JScrollPane(tabedPaneFile, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
						 JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPaneOutput = new JScrollPane(textAreaOutput, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 
        				   JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,scrollPaneFile, scrollPaneOutput);
		scrollPaneFile.setMinimumSize(new Dimension(800,300));
        scrollPaneOutput.setMinimumSize(new Dimension(800,100));
        scrollPaneFile.setPreferredSize(new Dimension(800,500));
		return splitPane;
	}
	public static JTabbedPane addMyTabbedPane(JTextArea textAreaFile, String title) {
		textAreaFile = new JTextArea();
		tabbedPane.add(title, textAreaFile);
		textAreaFile.getDocument().addDocumentListener(new MyTextAreaEvent());
		tabbedPane.addChangeListener(new TabbedPaneAction());
		tabbedPane.setSelectedIndex(tabbedPane.getTabCount()-1);
		setStatus(tabbedPane.getSelectedIndex());
		return tabbedPane;
	}
	public static void setStatus(int index) {
	    if (index > -1)
	    	selectedTabbed = " Selected Tab: " + index;
	    else
	    	selectedTabbed = " No Tab Selected";
	    System.out.println(selectedTabbed);
	  }
	public static void killTab() {
	    if (tabbedPane.getTabCount() > 0) {
	    	tabbedPane.removeTabAt(tabbedPane.getTabCount()-1);
	    	setStatus(tabbedPane.getSelectedIndex());
	    	tabbedPane.revalidate();
	    	tabbedPane.repaint();
	    }
	    else {
	    	setStatus(-1);
	    	tabbedPane.revalidate();
	    	tabbedPane.repaint();
	    }
	     
	  }
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -