本文整理汇总了Java中javax.swing.JTextPane.setOpaque方法的典型用法代码示例。如果您正苦于以下问题:Java JTextPane.setOpaque方法的具体用法?Java JTextPane.setOpaque怎么用?Java JTextPane.setOpaque使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextPane
的用法示例。
在下文中一共展示了JTextPane.setOpaque方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInfoPanel
import javax.swing.JTextPane; //导入方法依赖的package包/类
private static JTextPane createInfoPanel(String notification) {
JTextPane balloon = new JTextPane();
balloon.setContentType("text/html");
String text = getDetails(notification).replaceAll("(\r\n|\n|\r)", "<br>");
balloon.setText(text);
balloon.setOpaque(false);
balloon.setEditable(false);
balloon.setBorder(new EmptyBorder(0, 0, 0, 0));
if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
//#134837
//http://forums.java.net/jive/thread.jspa?messageID=283882
balloon.setBackground(new Color(0, 0, 0, 0));
}
balloon.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
URLDisplayer.getDefault().showURL(e.getURL());
}
}
});
return balloon;
}
示例2: getPane
import javax.swing.JTextPane; //导入方法依赖的package包/类
private JTextPane getPane(File[] files, File projectDir, String url, String revision) {
JTextPane bubble = new JTextPane();
bubble.setOpaque(false);
bubble.setEditable(false);
if (UIManager.getLookAndFeel().getID().equals("Nimbus")) { //NOI18N
//#134837
//http://forums.java.net/jive/thread.jspa?messageID=283882
bubble.setBackground(new Color(0, 0, 0, 0));
}
bubble.setContentType("text/html"); //NOI18N
setupPane(bubble, files, projectDir, url, revision);
return bubble;
}
示例3: initTextPane
import javax.swing.JTextPane; //导入方法依赖的package包/类
private void initTextPane (JTextPane pane) {
pane.setBorder(null);
pane.setLayout(null);
//fix for nimbus laf
pane.setOpaque(false);
pane.setBackground(new Color(0, 0, 0, 0));
}
示例4: getElementsComponent
import javax.swing.JTextPane; //导入方法依赖的package包/类
private JComponent getElementsComponent (String msg) {
JTextPane area = new JTextPane ();
area.setEditable (false);
area.setContentType ("text/html"); // NOI18N
area.setText (msg);
area.setOpaque (false);
area.setBackground(new Color(0, 0, 0, 0));
area.putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );
return area;
}
示例5: initializeComponents
import javax.swing.JTextPane; //导入方法依赖的package包/类
private void initializeComponents() {
infoPane = new JTextPane();
infoPane.setText("You are using version "+version+" but the current version is " +CalebKussmaul.getLatestVersion(p)+". It is strongly reccomended that you update to take advantage of the latest additions and fixes.");
StyledDocument doc = infoPane.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);
infoPane.setEditable(false);
infoPane.setOpaque(false);
updateButton = new JButton("Download update...");
}
示例6: getDefaultTextPane
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Get a {@code JTextPane} with default styles.
*
* @return The default {@code JTextPane} to use.
*/
public static JTextPane getDefaultTextPane() {
DefaultStyledDocument document
= new DefaultStyledDocument(STYLE_CONTEXT);
JTextPane textPane = new JTextPane(document);
textPane.setOpaque(false);
textPane.setEditable(false);
textPane.setLogicalStyle(STYLE_CONTEXT.getStyle("regular"));
return textPane;
}
示例7: disableOtherModules
import javax.swing.JTextPane; //导入方法依赖的package包/类
void disableOtherModules () {
Runnable runnable = new Runnable() {
@Override
public void run() {
boolean notify = false;
outter: for (int i = 0; i < otherGitModules.length; i++) {
FileLock lock = null;
OutputStream os = null;
try {
String newModule = otherGitModules[i];
String newModuleXML = "Modules/" + newModule.replace('.', '-') + ".xml"; // NOI18N
FileObject fo = FileUtil.getConfigFile(newModuleXML);
if (fo == null) continue;
Document document = readModuleDocument(fo);
NodeList list = document.getDocumentElement().getElementsByTagName("param"); // NOI18N
int n = list.getLength();
for (int j = 0; j < n; j++) {
Element node = (Element) list.item(j);
if ("enabled".equals(node.getAttribute("name"))) { // NOI18N
Text text = (Text) node.getChildNodes().item(0);
String value = text.getNodeValue();
if ("true".equals(value)) { // NOI18N
text.setNodeValue("false"); // NOI18N
break;
} else {
continue outter;
}
}
}
notify = true;
lock = fo.lock();
os = fo.getOutputStream(lock);
XMLUtil.write(document, os, "UTF-8"); // NOI18N
} catch (Exception e) {
Git.LOG.log(Level.WARNING, null, e);
} finally {
if (os != null) try { os.close(); } catch (IOException ex) {}
if (lock != null) lock.releaseLock();
}
}
if(notify) {
JTextPane ballonDetails = getPane(NbBundle.getBundle(ModuleLifecycleManager.class).getString("MSG_Install_Warning")); // using the same pane causes the balloon popup
JTextPane popupDetails = getPane(NbBundle.getBundle(ModuleLifecycleManager.class).getString("MSG_Install_Warning")); // to trim the text to the first line
NotificationDisplayer.getDefault().notify(
NbBundle.getMessage(ModuleLifecycleManager.class, "MSG_Install_Warning_Title"), //NOI18N
ImageUtilities.loadImageIcon("org/netbeans/modules/git/resources/icons/info.png", false),
ballonDetails, popupDetails, NotificationDisplayer.Priority.NORMAL, NotificationDisplayer.Category.WARNING);
}
}
private JTextPane getPane(String txt) {
JTextPane bubble = new JTextPane();
bubble.setOpaque(false);
bubble.setEditable(false);
if (UIManager.getLookAndFeel().getID().equals("Nimbus")) { //NOI18N
//#134837
//http://forums.java.net/jive/thread.jspa?messageID=283882
bubble.setBackground(new Color(0, 0, 0, 0));
}
bubble.setContentType("text/html"); //NOI18N
bubble.setText(txt);
return bubble;
}
};
RequestProcessor.getDefault().post(runnable);
}
示例8: CreditsFrame
import javax.swing.JTextPane; //导入方法依赖的package包/类
public CreditsFrame() {
super("Credits");
setLayout(new GridBagLayout());
GridBagConstraints gbc = ViewUtils.createGBC();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weighty=1;
gbc.insets = new Insets(0, 10, 10, 10);
JLabel logoLabel = new JLabel(new ImageIcon(ImageTools.scaleToHeight(ImageTools.getResourceImage("icon.png"), 100, false)));
logoLabel.setText("<HTML>GIFKR © 2017 Caleb Kussmaul");
logoLabel.setHorizontalTextPosition(JLabel.CENTER);
logoLabel.setVerticalTextPosition(JLabel.BOTTOM);
add(logoLabel, gbc);
gbc.gridy++;
gbc.weighty=0;
JTextPane dedicationPane = new JTextPane();
dedicationPane.setText("Dedicated to my dad, Wes Kussmaul, for inspiring my passion for programming, creativity, and entrepreneurship.");
dedicationPane.setOpaque(false);
dedicationPane.setEditable(false);
ViewUtils.centerText(dedicationPane);
add(dedicationPane, gbc);
gbc.gridy++;
JTextPane copyrightPane = new JTextPane();
copyrightPane.setText("Referenced libraries:\nOpen-Imaging under Apache 2.0\nJavaCV under Apache 2.0\nFFmpeg under LGPL 2.1");
add(copyrightPane, gbc);
gbc.gridy++;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.CENTER;
JCheckBox doNotShowBox = new JCheckBox("Do not show again", !GIFKRPrefs.showCreditsFrame());
doNotShowBox.addChangeListener(ce -> {
GIFKRPrefs.setShowCreditsFrame(!doNotShowBox.isSelected());
});
add(doNotShowBox, gbc);
setSize(500, 350);
setLocationRelativeTo(null);
setAlwaysOnTop(true);
}
示例9: main
import javax.swing.JTextPane; //导入方法依赖的package包/类
public static void main(String[] args) {
//Creates the JFrame and configures it.
JFrame window = new JFrame("Hash Generator 1.0");
window.setSize(670, 110);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLayout(new FlowLayout(FlowLayout.LEFT));
window.setResizable(false);
//Creates the JPanels.
JPanel panel = new JPanel();
window.add(panel);
//Creates the "Choose a file button."
JButton chooseFile = new JButton("Choose a file");
panel.add(chooseFile);
//Creates the file chooser with custom options.
String userDir = System.getProperty("user.home");
JFileChooser input = new JFileChooser(userDir +"/");
Action details = input.getActionMap().get("viewTypeDetails");
details.actionPerformed(null);
// Creates the output text field.
JTextPane finalText = new JTextPane();
finalText.setBorder(BorderFactory.createEmptyBorder());
finalText.setOpaque(false);
finalText.setEditable(false);
finalText.setPreferredSize( new Dimension( 520, 60 ) );
finalText.setText("MD5: \nSHA1: \nSHA-256: ");
panel.add(finalText);
//This will make the window appear.
window.setVisible(true);
//Adds a listener for when the button is clicked, it opens the file chooser.
chooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent onClick) {
//Opens the file chooser.
int result = input.showOpenDialog(chooseFile);
//When the file chooser opens, this will save the file and get the checksum.
if (result == JFileChooser.FILES_ONLY) {
try
{
//Gets the file from the file chooser.
File finalFile = new File(input.getSelectedFile().getAbsolutePath());
InputStream is = new FileInputStream(finalFile);
InputStream is2 = new FileInputStream(finalFile);
InputStream is3 = new FileInputStream(finalFile);
//Generate the checksum with the given file.
md5Final = DigestUtils.md5Hex(is);
sha1Final = DigestUtils.shaHex(is2);
sha256Final = DigestUtils.sha256Hex(is3);
//Puts the final output into the text box.
finalText.setText("MD5: " + md5Final + "\nSHA1: " + sha1Final + "\nSHA-256: " + sha256Final);
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
});
}