- 浏览: 725453 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
lingsuch:
Android网络连接判断与处理 -
月光照着我:
写的不错,作为笔记了
Android中LayoutInflater的使用 -
智博王锋:
好文章是要顶的!
Android中LayoutInflater的使用 -
云南白药:
...
Android中LayoutInflater的使用 -
万新one:
理解了许多。解释的不错。3Q.
Android中LayoutInflater的使用
import javax.swing.*; import javax.swing.text.*; import java.awt.*; public class StylesExample7 { public static void createDocumentStyles(StyleContext sc) { Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); // Create and add the main document style Style mainStyle = sc.addStyle(mainStyleName, defaultStyle); StyleConstants.setLeftIndent(mainStyle, 16); StyleConstants.setRightIndent(mainStyle, 16); StyleConstants.setFirstLineIndent(mainStyle, 16); StyleConstants.setFontFamily(mainStyle, "serif"); StyleConstants.setFontSize(mainStyle, 12); // Create and add the constant width style Style cwStyle = sc.addStyle(charStyleName, null); StyleConstants.setFontFamily(cwStyle, "monospaced"); StyleConstants.setForeground(cwStyle, Color.green); // Create and add the heading style Style heading2Style = sc.addStyle(heading2StyleName, null); StyleConstants.setForeground(heading2Style, Color.red); StyleConstants.setFontSize(heading2Style, 16); StyleConstants.setFontFamily(heading2Style, "serif"); StyleConstants.setBold(heading2Style, true); StyleConstants.setLeftIndent(heading2Style, 8); StyleConstants.setFirstLineIndent(heading2Style, 0); } public static void addText(JTextPane pane, StyleContext sc, Style logicalStyle, Paragraph[] content) { // The outer loop adds paragraphs, while the // inner loop adds character runs. int paragraphs = content.length; for (int i = 0; i < paragraphs; i++) { Run[] runs = content[i].content; for (int j = 0; j < runs.length; j++) { pane.setCharacterAttributes( runs[j].styleName == null ? SimpleAttributeSet.EMPTY : sc.getStyle(runs[j].styleName), true); pane.replaceSelection(runs[j].content); } // At the end of the paragraph, add the logical style and // any overriding paragraph style and then terminate the // paragraph with a newline. pane.setParagraphAttributes(SimpleAttributeSet.EMPTY, true); if (logicalStyle != null) { pane.setLogicalStyle(logicalStyle); } if (content[i].styleName != null) { pane.setParagraphAttributes(sc.getStyle(content[i].styleName), false); } pane.replaceSelection("\n"); } } public static void main(String[] args) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) {} JFrame f = new JFrame("Styles Example 7"); // Create the StyleContext, the document and the pane final StyleContext sc = new StyleContext(); final DefaultStyledDocument doc = new DefaultStyledDocument(sc); final JTextPane pane = new JTextPane(doc); // Build the styles createDocumentStyles(sc); try { // Add the text and apply the styles SwingUtilities.invokeAndWait(new Runnable() { public void run() { // Add the text addText(pane, sc, sc.getStyle(mainStyleName), content); } }); } catch (Exception e) { System.out.println("Exception when constructing document: " + e); System.exit(1); } f.getContentPane().add(new JScrollPane(pane)); f.setSize(400, 300); f.setVisible(true); } // Style names public static final String mainStyleName = "MainStyle"; public static final String heading2StyleName = "Heading2"; public static final String charStyleName = "ConstantWidth"; // Inner classes used to define paragraph structure public static class Run { public Run(String styleName, String content) { this.styleName = styleName; this.content = content; } public String styleName; public String content; } public static class Paragraph { public Paragraph(String styleName, Run[] content) { this.styleName = styleName; this.content = content; } public String styleName; public Run[] content; } public static final Paragraph[] content = new Paragraph[] { new Paragraph(heading2StyleName, new Run[] { new Run(null, "Attributes, Styles and Style Contexts") }), new Paragraph(null, new Run[] { new Run(null, "The simple "), new Run(charStyleName, "PlainDocument"), new Run(null, " class that you saw in the previous " + "chapter is only capable of holding text. " + "The more complex text components use a more " + "sophisticated model that implements the "), new Run(charStyleName, "StyledDocument"), new Run(null, " interface. "), new Run(charStyleName, "StyledDocument"), new Run(null, " is a sub-interface of "), new Run(charStyleName, "Document"), new Run(null, " that contains methods for manipulating attributes " + "that control the way in which the text in the " + "document is displayed. The Swing text package " + "contains a concrete implementation of "), new Run(charStyleName, "StyledDocument"), new Run(null, " called "), new Run(charStyleName, "DefaultStyledDocument"), new Run(null, " that is used as the default model for "), new Run(charStyleName, "JTextPane"), new Run(null, " and is also the base class from which " + "more specific models, such as the "), new Run(charStyleName, "HTMLDocument"), new Run(null, " class that handles input in HTML format, can be " + "created. In order to make use of "), new Run(charStyleName, "DefaultStyledDocument"), new Run(null, " and "), new Run(charStyleName, "JTextPane"), new Run(null, " you need to understand how Swing represents " + "and uses attributes.") }) }; }
发表评论
-
Swing中引入Android的NinePatch技术,让Swing拥有Android的外观定制能力
2012-09-21 09:22 1591【摘要】 本文诣在 ... -
JavaSwing实现支持合并拆分的JTable
2010-12-16 15:39 1945GridBagModel:抽象模型接口。该接口用于描述表格中单 ... -
JTable小例子,表格中使用JComboBox下拉按钮
2010-12-16 15:21 5397import java.awt.BorderLayout; ... -
配合滚动面板实现JTable上下翻页的效果
2010-12-16 14:26 3379import java.awt.BorderLayout; ... -
JScrollBar简单演示例子
2010-12-06 19:28 6585import java.awt.*; import java ... -
点击jtable的表头,数据会根据根据表头来排序
2010-12-06 11:47 5091import javax.swing.JFrame; imp ... -
重写JSplitPane的BasicSplitPaneUI
2010-09-18 13:39 1544import java.awt.Color; import ... -
Swing窗口初始最大化的方法
2010-08-20 11:09 78491.设置窗口最大(伪最大化) JFrame frame =n ... -
Tree目录实现拖拽功能演示实例(DragAndDrop)
2010-08-10 16:49 1769import java.awt.BorderLayout; ... -
设置JTextPane指定内容的颜色
2010-05-21 14:29 1328package Assis; import java.a ... -
ScaleImageDemo图像缩小与放大演示
2010-05-12 14:59 2074package Assis; import java.a ... -
TreesDemo
2010-05-04 11:19 1053import java.awt.*; import java ... -
TableDemo
2010-05-04 11:17 1167import javax.swing.JTable; imp ... -
分割面板演示JSplitPaneDemo
2010-05-04 11:12 1353//Java Swing 带分隔条的面板代码 impor ... -
StylesExample8
2010-04-08 12:55 1168import javax.swing.*; import j ... -
StylesExample6
2010-04-08 12:52 1037import javax.swing.*; import j ... -
StylesExample5
2010-04-08 12:51 972import javax.swing.*; import j ... -
StylesExample4
2010-04-08 12:50 1073import javax.swing.*; import j ... -
StylesExample3
2010-04-08 12:50 968import javax.swing.*; import j ... -
StylesExample2
2010-04-08 12:49 1021import javax.swing.*; import j ...
相关推荐
【Android】开发BLE 串口调试工具,用来和底层进行一些握手协议的调试。
机械设计自动锁垫片机(sw18可编辑+工程图+BOM)非常好的设计图纸100%好用.zip
基于Mediapipe的手势识别前端应用可执行程序+说明.zip # 项目简介 * 基于AutoHotkey制作的摄像头手势识别软件。能让你的电脑摄像头在识别手势后,执行自定义的电脑操作命令。同时也集成了语音识别功能,可调用Windows自带API实现简单的语音助手功能。 * 手势识别调用了高性能的Mediapipe动态链接库来免部署实现。而电脑自动化操作使用AutoHotkey脚本语言来实现,它能更方便的对电脑进行深度调用和流程自动化处理。 # 使用介绍 * 测试环境:Win10 64位(专业版完整镜像) * **第一次运行 Visual_Gesture_Recognition.exe**时,会提示下载手势识别的**依赖包**。点击**确定**后,跟着提示**点击自动下载**
Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。
python烟花代码python烟花代码.zip python烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zippython烟花代码.zip
如何提高APP商业变现能力.docx
Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。
在数字化时代,数据已成为一种宝贵的资源,而数据分析则是解锁这一资源的关键。数据分析是指运用适当的统计分析和数据挖掘方法,对收集来的大量数据进行详细的研究和概括总结,以最大化地开发数据的功能,发挥数据的作用。 数据分析的过程涉及数据的收集、整理、转化、建模和解释等多个环节。通过对比分析法、分组分析法、结构分析法等多种方法,我们能够深入挖掘数据中的隐藏信息和内在规律,为企业决策、市场研究、科学研究等领域提供有力的支持。 数据分析在现代社会中的应用越来越广泛。例如,在市场调研中,通过对消费者需求、竞争品牌分布等数据的分析,企业可以了解市场潜力、竞争优势和定位策略,从而制定有效的市场推广策略。在社交媒体数据分析中,企业可以通过分析用户的关注人群、点赞、转发等行为,揭示用户的兴趣爱好、消费倾向和口碑传播效果,从而制定有针对性的营销策略。 数据分析工具和技术的发展也极大地推动了数据分析的普及和应用。如R语言和Python语言等编程工具,以及SAS等商业化的数据分析软件,都为数据分析提供了强大的支持。这些工具不仅具有丰富的统计函数和图表绘制能力,还具有高度的灵活性和可扩展性,可以满足各种要求
水和废水处理化学品的选择和使用指南
在Python中,可以使用多种方法来创建一个虚拟棋盘。下面是一个简单的示例,使用字符串和循环来创建一个8x8的国际象棋棋盘。 这段代码定义了一个函数print_chessboard,它首先定义了棋盘的一半,然后通过循环来构建整个棋盘。棋盘的每个格子用空格分隔,并且棋盘的行号用数字表示。棋盘的黑白格子使用字符串white和black来表示,其中white表示白格子,而black表示黑格子。 运行这段代码,你会在控制台看到一个8x8的棋盘,其中棋盘的行号从1到8,列号从A到H,棋盘的黑白格子交替出现。 请注意,这个棋盘是虚拟的,仅用于展示布局,并没有实现任何棋盘游戏的逻辑。如果你需要实现一个可以进行游戏的棋盘,你需要添加更多的代码来处理棋子的移动和游戏规则。
系统使用了Modbus协议完成数据的获取工作,通过Mqtt协议与后端进行连接,获取了数据,完成了数据采集工作。后端通过对数据的处理,进行了数据存储,和接口api的处理。通过WebSocket协议来推送数据。前端展示请求的后端数据。通过此流程完成了工业暖通空调系统的开发。
机械设计大倾角波状挡边带式输送机sw17可编辑非常好的设计图纸100%好用.zip
常见移动变现术语(mobile monetization).docx
把input里面的数据替换成自己的数据,打开R,点Run,可以直接出图!文件适合有R语言基础的同学。
福克斯初级和猎犬初级电线追踪工具包使用说明书
数据库实验报告 SJK完整性语言
PDU8000 ATS配电箱-T 快速指南
串口协议 串口通过 YMODEM 协议进行文件传输 开发环境 框架:Qt 5.7.1 编译器:MSVC2015_64bit IDE:Qt Creator 4.2.0 社区版 操作系统:Windows 10 专业版
开发语言:Java JDK版本:JDK1.8(或11) 服务器:tomcat 数据库:mysql 5.6/5.7(或8.0) 数据库工具:Navicat 开发软件:idea 依赖管理包:Maven 代码+数据库保证完整可用,可提供远程调试并指导运行服务(额外付费)~ 如果对系统的中的某些部分感到不合适可提供修改服务,比如题目、界面、功能等等... 声明: 1.项目已经调试过,完美运行 2.需要远程帮忙部署项目,需要额外付费 3.本项目有演示视频,如果需要观看,请联系我 4.调试过程中可帮忙安装IDEA,eclipse,MySQL,JDK,Tomcat等软件 重点: 需要其他Java源码联系我,更多源码任你选,你想要的源码我都有! https://img-blog.csdnimg.cn/direct/e73dc0ac8d27434b86d886db5a438c71.jpeg
SITOP 电源电源电源电源 20 6EP1 536-2AA00 操作手册