https://www.cnblogs.com/yanjie-java/p/8329631.html

  1 package com.java.connect.poi;
2
3 import java.io.FileOutputStream;
4 import java.io.IOException;
5
6 import org.apache.poi.ss.usermodel.Cell;
7 import org.apache.poi.ss.usermodel.CellStyle;
8 import org.apache.poi.ss.usermodel.IndexedColors;
9 import org.apache.poi.ss.usermodel.Row;
10 import org.apache.poi.ss.usermodel.Sheet;
11 import org.apache.poi.ss.usermodel.Workbook;
12 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
13
14 public class POIFillAndColorExample {
15 public static void main(String[] args) throws IOException {
16 // Create a workbook object
17 Workbook workbook = new XSSFWorkbook();
18 // Create sheet
19 Sheet sheet = workbook.createSheet();
20
21 // Create a row and put some cells in it.
22 Row row = sheet.createRow((short) 1);
23
24 // Aqua background
25 CellStyle style = workbook.createCellStyle();
26 style.setFillForegroundColor(IndexedColors.AQUA.getIndex());
27 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
28 Cell cell = row.createCell((short) 1);
29 cell.setCellValue("X1");
30 cell.setCellStyle(style);
31
32 // Orange "foreground", foreground being the fill foreground not the
33 // font color.
34 style = workbook.createCellStyle();
35 style.setFillForegroundColor(IndexedColors.AUTOMATIC.getIndex());
36 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
37 cell = row.createCell((short) 2);
38 cell.setCellValue("X2");
39 cell.setCellStyle(style);
40
41 style = workbook.createCellStyle();
42 style.setFillForegroundColor(IndexedColors.BLUE.getIndex());
43 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
44 cell = row.createCell((short) 3);
45 cell.setCellValue("X3");
46 cell.setCellStyle(style);
47
48 style = workbook.createCellStyle();
49 style.setFillForegroundColor(IndexedColors.BLUE_GREY.getIndex());
50 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
51 cell = row.createCell((short) 4);
52 cell.setCellValue("X4");
53 cell.setCellStyle(style);
54
55 style = workbook.createCellStyle();
56 style.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
57 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
58 cell = row.createCell((short) 5);
59 cell.setCellValue("X5");
60 cell.setCellStyle(style);
61
62 // Create a row and put some cells in it.
63 Row row2 = sheet.createRow((short) 2);
64
65 style = workbook.createCellStyle();
66 style.setFillForegroundColor(IndexedColors.BROWN.getIndex());
67 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
68 cell = row2.createCell((short) 1);
69 cell.setCellValue("X6");
70 cell.setCellStyle(style);
71
72 style = workbook.createCellStyle();
73 style.setFillForegroundColor(IndexedColors.CORAL.getIndex());
74 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
75 cell = row2.createCell((short) 2);
76 cell.setCellValue("X7");
77 cell.setCellStyle(style);
78
79 style = workbook.createCellStyle();
80 style.setFillForegroundColor(IndexedColors.CORNFLOWER_BLUE.getIndex());
81 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
82 cell = row2.createCell((short) 3);
83 cell.setCellValue("X8");
84 cell.setCellStyle(style);
85
86 style = workbook.createCellStyle();
87 style.setFillForegroundColor(IndexedColors.DARK_BLUE.getIndex());
88 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
89 cell = row2.createCell((short) 4);
90 cell.setCellValue("X9");
91 cell.setCellStyle(style);
92 style = workbook.createCellStyle();
93 style.setFillForegroundColor(IndexedColors.DARK_GREEN.getIndex());
94 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
95 cell = row2.createCell((short) 5);
96 cell.setCellValue("X10");
97 cell.setCellStyle(style);
98
99 // Create a row and put some cells in it.
100 Row row3 = sheet.createRow((short) 3);
101
102 style = workbook.createCellStyle();
103 style.setFillForegroundColor(IndexedColors.DARK_RED.getIndex());
104 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
105 cell = row3.createCell((short) 1);
106 cell.setCellValue("X11");
107 cell.setCellStyle(style);
108 style = workbook.createCellStyle();
109 style.setFillForegroundColor(IndexedColors.DARK_TEAL.getIndex());
110 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
111 cell = row3.createCell((short) 2);
112 cell.setCellValue("X12");
113 cell.setCellStyle(style);
114
115 style = workbook.createCellStyle();
116 style.setFillForegroundColor(IndexedColors.DARK_YELLOW.getIndex());
117 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
118 cell = row3.createCell((short) 3);
119 cell.setCellValue("X13");
120 cell.setCellStyle(style);
121 style = workbook.createCellStyle();
122 style.setFillForegroundColor(IndexedColors.GOLD.getIndex());
123 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
124 cell = row3.createCell((short) 4);
125 cell.setCellValue("X14");
126 cell.setCellStyle(style);
127
128 style = workbook.createCellStyle();
129 style.setFillForegroundColor(IndexedColors.GREEN.getIndex());
130 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
131 cell = row3.createCell((short) 5);
132 cell.setCellValue("X15");
133 cell.setCellStyle(style);
134
135 // Create a row and put some cells in it.
136 Row row4 = sheet.createRow((short) 4);
137 style = workbook.createCellStyle();
138 style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
139 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
140 cell = row4.createCell((short) 1);
141 cell.setCellValue("X16");
142 cell.setCellStyle(style);
143
144 style = workbook.createCellStyle();
145 style.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());
146 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
147 cell = row4.createCell((short) 2);
148 cell.setCellValue("X17");
149 cell.setCellStyle(style);
150 style = workbook.createCellStyle();
151 style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
152 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
153 cell = row4.createCell((short) 3);
154 cell.setCellValue("X18");
155 cell.setCellStyle(style);
156
157 style = workbook.createCellStyle();
158 style.setFillForegroundColor(IndexedColors.GREY_80_PERCENT.getIndex());
159 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
160 cell = row4.createCell((short) 4);
161 cell.setCellValue("X19");
162 cell.setCellStyle(style);
163 style = workbook.createCellStyle();
164 style.setFillForegroundColor(IndexedColors.INDIGO.getIndex());
165 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
166 cell = row4.createCell((short) 5);
167 cell.setCellValue("X20");
168 cell.setCellStyle(style);
169
170 // Create a row and put some cells in it.
171 Row row5 = sheet.createRow((short) 5);
172
173 style = workbook.createCellStyle();
174 style.setFillForegroundColor(IndexedColors.LAVENDER.getIndex());
175 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
176 cell = row5.createCell((short) 1);
177 cell.setCellValue("X21");
178 cell.setCellStyle(style);
179
180 style = workbook.createCellStyle();
181 style.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex());
182 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
183 cell = row5.createCell((short) 2);
184 cell.setCellValue("X22");
185 cell.setCellStyle(style);
186
187 style = workbook.createCellStyle();
188 style.setFillForegroundColor(IndexedColors.LIGHT_BLUE.getIndex());
189 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
190 cell = row5.createCell((short) 3);
191 cell.setCellValue("X23");
192 cell.setCellStyle(style);
193 style = workbook.createCellStyle();
194 style.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex());
195 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
196 cell = row5.createCell((short) 4);
197 cell.setCellValue("X24");
198 cell.setCellStyle(style);
199
200 style = workbook.createCellStyle();
201 style.setFillForegroundColor(IndexedColors.LIGHT_BLUE.getIndex());
202 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
203 cell = row5.createCell((short) 5);
204 cell.setCellValue("X25");
205 cell.setCellStyle(style);
206
207 // Create a row and put some cells in it.
208 Row row6 = sheet.createRow((short) 6);
209 style = workbook.createCellStyle();
210 style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE
211 .getIndex());
212 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
213 cell = row6.createCell((short) 1);
214 cell.setCellValue("X26");
215 cell.setCellStyle(style);
216
217 style = workbook.createCellStyle();
218 style.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
219 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
220 cell = row6.createCell((short) 2);
221 cell.setCellValue("X27");
222 cell.setCellStyle(style);
223 style = workbook.createCellStyle();
224 style.setFillForegroundColor(IndexedColors.LIGHT_ORANGE.getIndex());
225 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
226 cell = row6.createCell((short) 3);
227 cell.setCellValue("X28");
228 cell.setCellStyle(style);
229
230 style = workbook.createCellStyle();
231 style.setFillForegroundColor(IndexedColors.LIGHT_TURQUOISE.getIndex());
232 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
233 cell = row6.createCell((short) 4);
234 cell.setCellValue("X29");
235 cell.setCellStyle(style);
236
237 style = workbook.createCellStyle();
238 style.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex());
239 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
240 cell = row6.createCell((short) 5);
241 cell.setCellValue("X30");
242 cell.setCellStyle(style);
243
244 // Create a row and put some cells in it.
245 Row row7 = sheet.createRow((short) 7);
246 style = workbook.createCellStyle();
247 style.setFillForegroundColor(IndexedColors.LIME.getIndex());
248 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
249 cell = row7.createCell((short) 1);
250 cell.setCellValue("X31");
251 cell.setCellStyle(style);
252 style = workbook.createCellStyle();
253 style.setFillForegroundColor(IndexedColors.MAROON.getIndex());
254 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
255 cell = row7.createCell((short) 2);
256 cell.setCellValue("X32");
257 cell.setCellStyle(style);
258
259 style = workbook.createCellStyle();
260 style.setFillForegroundColor(IndexedColors.OLIVE_GREEN.getIndex());
261 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
262 cell = row7.createCell((short) 3);
263 cell.setCellValue("X33");
264 cell.setCellStyle(style);
265 style = workbook.createCellStyle();
266 style.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
267 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
268 cell = row7.createCell((short) 4);
269 cell.setCellValue("X34");
270 cell.setCellStyle(style);
271
272 style = workbook.createCellStyle();
273 style.setFillForegroundColor(IndexedColors.ORCHID.getIndex());
274 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
275 cell = row7.createCell((short) 5);
276 cell.setCellValue("X35");
277 cell.setCellStyle(style);
278
279 // Create a row and put some cells in it.
280 Row row8 = sheet.createRow((short) 8);
281
282 style = workbook.createCellStyle();
283 style.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
284 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
285 cell = row8.createCell((short) 1);
286 cell.setCellValue("X36");
287 cell.setCellStyle(style);
288
289 style = workbook.createCellStyle();
290 style.setFillForegroundColor(IndexedColors.PINK.getIndex());
291 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
292 cell = row8.createCell((short) 2);
293 cell.setCellValue("X37");
294 cell.setCellStyle(style);
295 style = workbook.createCellStyle();
296 style.setFillForegroundColor(IndexedColors.PLUM.getIndex());
297 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
298 cell = row8.createCell((short) 3);
299 cell.setCellValue("X38");
300 cell.setCellStyle(style);
301
302 style = workbook.createCellStyle();
303 style.setFillForegroundColor(IndexedColors.RED.getIndex());
304 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
305 cell = row8.createCell((short) 4);
306 cell.setCellValue("X39");
307 cell.setCellStyle(style);
308 style = workbook.createCellStyle();
309 style.setFillForegroundColor(IndexedColors.ROSE.getIndex());
310 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
311 cell = row8.createCell((short) 5);
312 cell.setCellValue("X40");
313 cell.setCellStyle(style);
314
315 // Create a row and put some cells in it.
316 Row row9 = sheet.createRow((short) 9);
317
318 style = workbook.createCellStyle();
319 style.setFillForegroundColor(IndexedColors.ROYAL_BLUE.getIndex());
320 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
321 cell = row9.createCell((short) 1);
322 cell.setCellValue("X41");
323 cell.setCellStyle(style);
324 style = workbook.createCellStyle();
325 style.setFillForegroundColor(IndexedColors.SEA_GREEN.getIndex());
326 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
327 cell = row9.createCell((short) 2);
328 cell.setCellValue("X42");
329 cell.setCellStyle(style);
330
331 style = workbook.createCellStyle();
332 style.setFillForegroundColor(IndexedColors.SKY_BLUE.getIndex());
333 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
334 cell = row9.createCell((short) 3);
335 cell.setCellValue("X43");
336 cell.setCellStyle(style);
337 style = workbook.createCellStyle();
338 style.setFillForegroundColor(IndexedColors.TAN.getIndex());
339 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
340 cell = row9.createCell((short) 4);
341 cell.setCellValue("X44");
342 cell.setCellStyle(style);
343
344 style = workbook.createCellStyle();
345 style.setFillForegroundColor(IndexedColors.TEAL.getIndex());
346 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
347 cell = row9.createCell((short) 5);
348 cell.setCellValue("X45");
349 cell.setCellStyle(style);
350
351 // Create a row and put some cells in it.
352 Row row10 = sheet.createRow((short) 10);
353
354 style = workbook.createCellStyle();
355 style.setFillForegroundColor(IndexedColors.TURQUOISE.getIndex());
356 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
357 cell = row10.createCell((short) 1);
358 cell.setCellValue("X46");
359 cell.setCellStyle(style);
360
361 style = workbook.createCellStyle();
362 style.setFillForegroundColor(IndexedColors.VIOLET.getIndex());
363 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
364 cell = row10.createCell((short) 2);
365 cell.setCellValue("X47");
366 cell.setCellStyle(style);
367 style = workbook.createCellStyle();
368 style.setFillForegroundColor(IndexedColors.WHITE.getIndex());
369 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
370 cell = row10.createCell((short) 3);
371 cell.setCellValue("X48");
372 cell.setCellStyle(style);
373
374 style = workbook.createCellStyle();
375 style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
376 style.setFillPattern(CellStyle.SOLID_FOREGROUND);
377 cell = row10.createCell((short) 3);
378 cell.setCellValue("X49");
379 cell.setCellStyle(style);
380
381 // Write the output to a file
382 FileOutputStream fileOut = new FileOutputStream(
383 "POIFillAndColorExample.xlsx");
384 workbook.write(fileOut);
385 fileOut.close();
386
387 }
388 }

生成的excel文件看起来像下面的图片。

color org.apache.poi.hssf.util.HSSFColor$GREY_80_PERCENT@1aadbf7
color org.apache.poi.hssf.util.HSSFColor$INDIGO@4f4458
color org.apache.poi.hssf.util.HSSFColor$PLUM@100c56
color org.apache.poi.hssf.util.HSSFColor$BROWN@19a1fae
color org.apache.poi.hssf.util.HSSFColor$OLIVE_GREEN@1960c9e
color org.apache.poi.hssf.util.HSSFColor$DARK_GREEN@168f39
color org.apache.poi.hssf.util.HSSFColor$SEA_GREEN@11525cd
color org.apache.poi.hssf.util.HSSFColor$DARK_TEAL@164e67f
color org.apache.poi.hssf.util.HSSFColor$GREY_40_PERCENT@158cfda
color org.apache.poi.hssf.util.HSSFColor$BLUE_GREY@1b613c0
color org.apache.poi.hssf.util.HSSFColor$ORANGE@cae1b3
color org.apache.poi.hssf.util.HSSFColor$LIGHT_ORANGE@1a7e798
color org.apache.poi.hssf.util.HSSFColor$GOLD@55d1ef
color org.apache.poi.hssf.util.HSSFColor$LIME@49b9ad
color org.apache.poi.hssf.util.HSSFColor$AQUA@3d0f0e
color org.apache.poi.hssf.util.HSSFColor$LIGHT_BLUE@a7624e
color org.apache.poi.hssf.util.HSSFColor$TAN@1271218
color org.apache.poi.hssf.util.HSSFColor$LAVENDER@150b2d
color org.apache.poi.hssf.util.HSSFColor$ROSE@190c9dc
color org.apache.poi.hssf.util.HSSFColor$PALE_BLUE@b4bc8e
color org.apache.poi.hssf.util.HSSFColor$LIGHT_YELLOW@1c74456
color org.apache.poi.hssf.util.HSSFColor$LIGHT_GREEN@15783a2
color org.apache.poi.hssf.util.HSSFColor$LIGHT_TURQUOISE@830993
color org.apache.poi.hssf.util.HSSFColor$SKY_BLUE@e99642
color org.apache.poi.hssf.util.HSSFColor$BLUE@187f194
color org.apache.poi.hssf.util.HSSFColor$TEAL@55f9f
color org.apache.poi.hssf.util.HSSFColor$DARK_RED@c8e08f
color org.apache.poi.hssf.util.HSSFColor$VIOLET@edd19
color org.apache.poi.hssf.util.HSSFColor$TURQUOISE@1d5c7a1
color org.apache.poi.hssf.util.HSSFColor$YELLOW@252119
color org.apache.poi.hssf.util.HSSFColor$PINK@19ff062
color org.apache.poi.hssf.util.HSSFColor$DARK_BLUE@15eb4d0
color org.apache.poi.hssf.util.HSSFColor$LIGHT_CORNFLOWER_BLUE@b0e84b
color org.apache.poi.hssf.util.HSSFColor$ROYAL_BLUE@62a19d
color org.apache.poi.hssf.util.HSSFColor$CORAL@16075b3
color org.apache.poi.hssf.util.HSSFColor$ORCHID@1cf46c2
color org.apache.poi.hssf.util.HSSFColor$LIGHT_TURQUOISE@12e8a41
color org.apache.poi.hssf.util.HSSFColor$LEMON_CHIFFON@76ec7a
color org.apache.poi.hssf.util.HSSFColor$PLUM@19f7952
color org.apache.poi.hssf.util.HSSFColor$CORNFLOWER_BLUE@d60cdd
color org.apache.poi.hssf.util.HSSFColor$GREY_50_PERCENT@e6bc11
color org.apache.poi.hssf.util.HSSFColor$GREY_25_PERCENT@452267
color org.apache.poi.hssf.util.HSSFColor$TEAL@d5b614
color

org.apache.poi.hssf.util.HSSFColor$VIOLET@a4e3ae

color org.apache.poi.hssf.util.HSSFColor$DARK_YELLOW@15fd4a3
color org.apache.poi.hssf.util.HSSFColor$DARK_BLUE@8137c9
color org.apache.poi.hssf.util.HSSFColor$GREEN@1757596
color org.apache.poi.hssf.util.HSSFColor$DARK_RED@7ad4d5
color org.apache.poi.hssf.util.HSSFColor$TURQUOISE@2aee3f
color org.apache.poi.hssf.util.HSSFColor$PINK@7f788b
color org.apache.poi.hssf.util.HSSFColor$YELLOW@c311d5
color org.apache.poi.hssf.util.HSSFColor$BLUE@c7e580
color org.apache.poi.hssf.util.HSSFColor$BRIGHT_GREEN@1ac55ac
color org.apache.poi.hssf.util.HSSFColor$RED@12cc460
color org.apache.poi.hssf.util.HSSFColor$WHITE@10ad7e
color

org.apache.poi.hssf.util.HSSFColor$BLACK@ee336f

 
 

POI IndexedColors 编码 与 颜色 对照的更多相关文章

  1. C#颜色对照使用表

    这篇文章来来源于C# Color Table,这里是我翻译的中文版本,其中已经加上了我的一些理解和注释.翻译这篇文章的原因是我在写C#程序的时候发现,C#自带的颜色种类极多(详见下表),如果没有直观的 ...

  2. android 颜色对照

    <table><tbody> <tr> <td bgcolor="#ffffff" width="30" height ...

  3. RGB颜色对照图

  4. 利用poi,jxl将Excel数据导入数据库

    需求:‘需要将本地的Excel中的数据经过验证之后导入数据库,在导入数据库之前在页面上展示出来 思路:将Excel导入存到session里面 去判断有没有不合法数据  如果有阻止提交 工具类: imp ...

  5. WEBGL学习【十三】鼠标点击立方体改变颜色的原理与实现

    // PickFace.js (c) 2012 matsuda and kanda // Vertex shader program var VSHADER_SOURCE = 'attribute v ...

  6. POI3的资料整理

    转自http://aman.cao.blog.163.com/blog/static/32951336201010823557408/ POI3的资料整理一.POI简介 Jakarta POI 是ap ...

  7. 老男孩Day15作业:商城列表页面(静态)

    一. 一.作业需求: 1.完成商城列表静态页面的抒写 二.博客地址:https://www.cnblogs.com/catepython/p/9205636.html 三.运行环境 操作系统:Win1 ...

  8. 个人永久性免费-Excel催化剂功能第92波-地理地址与经纬度互转功能

    GPS设备和手机LBS的兴起,在地理信息存储过程中,在程序.应用级别是需要用经纬度去定位,而在数据分析的级别,特别是省市区镇街的分析,用到的是人可识别的文本类型存储,从设备中采集下来的数据和人工维护的 ...

  9. .net提交HTML元素到后台,遇到Request报错 解决方案

    对于.NET MVC 项目来说,在Controller中对应的Action方法上打上标签: [ValidateInput(false)] 在MSDN上:HttpRequest 类使用输入验证标志来跟踪 ...

随机推荐

  1. Java 动态代理与AOP

    动态代理与AOP 代理模式 代理模式给某一个目标对象(target)提供代理对象(proxy),并由代理对象控制对target对象的引用. 模式图: 代理模式中的角色有: 抽象对象角色(Abstrac ...

  2. istio1.0 实现蓝绿发布(未完成)

    istio1.0 实现蓝绿发布 环境: 192.168.0.91 master 192.168.0.92 node 第一步:安装k8s集群,参照:https://www.cnblogs.com/eff ...

  3. 【记录】【springboot】动态定时任务ScheduledFuture,可添加、修改、删除

    这里只演示添加和删除任务的,因为修改就是删除任务再添加而已. 方便演示,任务就是每3秒打印 1.没有任务 后台 2.添加一个任务 3.再添加一个任务 4.删除一个任务 5.再添加一个任务 6.代码 运 ...

  4. java中的内存分配问题

    class A{ int i; int j; } clsaa demo{ public static void main(String[] args){ A aa = new A(); A aa; / ...

  5. BFS --- 素数环

    <传送门> [题目大意]对话很坑爹,不过很有意思,直接看题干就可以了.给你两个四位数a和b,现在要你从a经过变换得到b,并且变换的中间的每一位都要是素数,并且相邻两个素数之间只能有一个位不 ...

  6. codeforces --- Round #250 (Div. 2) B. The Child and Set

    <传送门> [题目大意] 给你一个sum和一个limit,现在要你在1~limit中找到一些数来使得这些数的和等于sum,如果能找到的话就输出找到的数的个数和这些数,未找到输出" ...

  7. LInux因为缺失网关出现Name or service not known的解决方法

    笔者使用的VMware和CentOS 7.0.在安装完镜像包后,便开始配置静态ip.命令如下 vi /etc/sysconfig/network-scripts/ifcfg-ens33 将BOOTPR ...

  8. cf-786B区间图最短路

    https://www.cnblogs.com/31415926535x/p/11611801.html 偶然看到的这个东西,可以说是第一次见到图论+数据结构的题了,,这题代码很简单,细节处理一下就没 ...

  9. DRF框架(二)——解析模块(parsers)、异常模块(exception_handler)、响应模块(Response)、三大序列化组件介绍、Serializer组件(序列化与反序列化使用)

    解析模块 为什么要配置解析模块 1)drf给我们提供了多种解析数据包方式的解析类 form-data/urlencoded/json 2)我们可以通过配置来控制前台提交的哪些格式的数据后台在解析,哪些 ...

  10. DS 红黑树详解

    通过上篇博客知道,二叉搜索树的局限在于不能完成自平衡,从而导致不能一直保持高性能. AVL树则定义了平衡因子绝对值不能大于1,使二叉搜索树达到了严格的高度平衡. 还有一种能自我调整的二叉搜索树, 红黑 ...